meteorhacks / npm

Complete NPM integration for Meteor
http://meteorhacks.com/complete-npm-integration-for-meteor.html
MIT License
508 stars 43 forks source link

Cannot find module #84

Open renatorib opened 9 years ago

renatorib commented 9 years ago

I don't know exactly why but I have this error when I try to run meteor:

packages.json:

{
  "tibia-node-crawler": "0.1.2"
}

server/main.js:

var Tibia = Meteor.npmRequire('tibia-node-crawler');

Error: Cannot find module 'tibia-node-crawler'

MomchilGorchev commented 9 years ago

Same here but with pingwrap module

tkon99 commented 9 years ago

Same here with request package

woniesong92 commented 9 years ago

getting the same error with pusher

Edit: I solved it by running Meteor.require("moduleName") instead of Meteor.npmRequire. After the dependencies are installed, I could start using npmRequire again. Does it work for you guys?

rbaindourov commented 8 years ago

I'm having a problem with Meteor.npmRequire as well for the crypto npm package.

I started a fresh Meteor 1.2 project yesterday, and added meteor hacks to project this morning.

Literally a one liner is failing for me.

W20150924-08:52:05.281(-7)? (STDERR)
W20150924-08:52:05.282(-7)? (STDERR) /Users/robert/.meteor/packages/meteor-tool/.1.1.8.1ywvo10++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150924-08:52:05.282(-7)? (STDERR)                        throw(ex);
W20150924-08:52:05.282(-7)? (STDERR)                              ^
W20150924-08:52:05.285(-7)? (STDERR) Error: Cannot find module '/Users/robert/dev/paysimple-meteor/.meteor/local/build/programs/server/npm/npm-container/node_modules/crypto'
W20150924-08:52:05.285(-7)? (STDERR)     at Function.Module._resolveFilename (module.js:338:15)
W20150924-08:52:05.285(-7)? (STDERR)     at Function.Module._load (module.js:280:25)
W20150924-08:52:05.285(-7)? (STDERR)     at Module.require (module.js:364:17)
W20150924-08:52:05.285(-7)? (STDERR)     at require (module.js:380:17)
W20150924-08:52:05.286(-7)? (STDERR)     at Object.Npm.require (/Users/robert/dev/paysimple-meteor/.meteor/local/build/programs/server/boot.js:162:18)
W20150924-08:52:05.286(-7)? (STDERR)     at Object.Meteor.npmRequire (packages/npm-container/index.js:2:1)
W20150924-08:52:05.286(-7)? (STDERR)     at server/init.js:3:8
W20150924-08:52:05.286(-7)? (STDERR)     at /Users/robert/dev/paysimple-meteor/.meteor/local/build/programs/server/app/server/init.js:40:4
W20150924-08:52:05.286(-7)? (STDERR)     at /Users/robert/dev/paysimple-meteor/.meteor/local/build/programs/server/boot.js:242:10
W20150924-08:52:05.286(-7)? (STDERR)     at Array.forEach (native)

But when I follow the bread crumbs I see the crypto folder is there, and all the files seem like the ones in the github repo

drwxr-xr-x   6 robert  staff  204 Sep 24 08:51 .
drwxr-xr-x   6 robert  staff  204 Sep 24 08:51 ..
-rw-r--r--   1 robert  staff    8 Sep 24 08:51 .node_version
-rw-r--r--   1 robert  staff   75 Sep 24 08:51 .npm-shrinkwrap.json
-rw-r--r--   1 robert  staff  103 Sep 24 08:51 .package.json
drwxr-xr-x  11 robert  staff  374 Sep 24 08:51 crypto

What am I doing wrong? I was passing under a tunnel the first time, and did get a "are you connected to the internet?" error message.

So I even tried

meteor remove npm-container
meteor update meteorhacks:npm

@woniesong92 using Meteor.require first didn't work either.

Thanks in Advance!

EDIT:

I see now that I did not need crypto package from Gozala and that its actually built into NodeJS.

What solved my issue was just using

let crypto =  Npm.require('crypto')
JulianKingman commented 8 years ago

I'm having the same problem with cheerio. I don't know what changed, but suddenly I get this error: Error: Cannot find module 'cheerio'

Deleting the NPM files and packages, and reinstalling, seemed to work (per #55).

Amritpd commented 8 years ago

What worked for me is running the command meteor npm install --save <nameofpackage> In my case I ran meteor npm install --save webshot. At least my project compiles now!

guillefix commented 8 years ago

I am using Meteor 1.3, and the package mathquill is giving me Cannot find module 'mathquill'. I installed using meteor npm install --save mathquill

mobiglas commented 7 years ago

I fixed this error by using Npm.require instead of require