Skip to content

Getting "Error: Cannot find module" when installing custom plugin #3387

Discussion options

You must be logged in to vote

The "Cannot find module" error is correct: if you start a node repl and do require("@zerodevapp/mock-server"), you'll get the same error.

I think the problem is that the pacakge.json file in that package doesn't have a main entry, so it defaults to index.js, which doesn't exist. Try adding "main": "dist/index.js" to that package.json.

The reason it did work for src/index.ts is (I think) that you are not doing anything with the imports, so no requires are generated. This is just a guess though, but it's very likely that's the explanation.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@hexcowboy
Comment options

Answer selected by hexcowboy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants