question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module './dist/index.js'

See original GitHub issue

Since the merge of https://github.com/PrismarineJS/node-minecraft-protocol/pull/115, require('minecraft-protocol') fails for me with:

> require('minecraft-protocol')
Error: Cannot find module './dist/index.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (node-minecraft-protocol/index.js:1:80)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

I ran npm install in the node-minecraft-protocol directory but it only outputs a few warnings, no errors:

node-minecraft-protocol $ npm install
npm WARN package.json batch@0.3.2 No repository field.
npm WARN package.json ansi-color@0.2.1 'repositories' (plural) Not supported. Please pick one as the 'repository' field

if I revert 439c240247faedbbde46849d6be9a3f8721e3b6a, then the require() succeeds.

I am not familiar with server-side build processes but best I can tell this has to do with gulp, which seems to be supposed to generate ./dist/index.js. If so should a shell command to invoke gulp be added to the package.json install script or what?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
deathcapcommented, Mar 8, 2015

Thanks, if I run npm install -g gulp && gulp then it does create the compiled dist files as expected.

Could this step be documented somewhere? (not obvious for someone who hasn’t ever used gulp)

0reactions
deathcapcommented, Mar 24, 2015
tmp $ npm install minecraft-protocol
minecraft-protocol@0.13.2 node_modules/minecraft-protocol
tmp $ node
> require('minecraft-protocol')
{ createClient: [Function: createClient],
…

0.13.2 works great, thanks! I’m fine with closing this (unless you want to keep it open for https://github.com/npm/npm/pull/7627, but I’m at least no longer hitting it in my normal workflow using npm link)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
This happens when a first npm install has crashed for some reason (SIGINT of npm), or that the delay was too long, or...
Read more >
"Cannot find module" when main file not index.js with ... - GitHub
The solution is to upgrade to Node.js v16.4.0 or later, or wait for v14.17.4 once it is released next week. I'll try to...
Read more >
Cannot find module 'X' error in Node.js | bobbyhadz
To solve the "Cannot find module" error in Node.js, make sure to install the package from the error message if it's a third-party...
Read more >
Error: Cannot find module - Render community
Hello community, I have a problem with my first deployment of the express application in render.com, the console shows an error Error: The ......
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found