I Have installed the below npm module
https://github.com/feross/simple-peer
by,
#sudo npm install simple-peer -g
But When tried including the module, it is unable to find the module. I received the below error
module.js:340
throw err;
^
Error: Cannot find module 'simple-peer'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/cst/poc/test.js:1:73)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
In my sample code I just had
var pee = require('simple-peer');
Related
after installing through npm, was also installing Expo before this error
module.js:472
throw err;
^
Error: Cannot find module 'to-fast-properties'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\nbeni\Documents\Modelfy Inc Repo\Modelfy\node_modules\babel-types\lib\index.js:317:25)
at Object.<anonymous> (C:\Users\nbeni\Documents\Modelfy Inc Repo\Modelfy\node_modules\babel-types\lib\index.js:836:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
I've used node and npm before in one or two projects, but I'm not really proficient with it. I now want to initialize a new project on MacOS by using npm init, but I get this:
$ npm init
module.js:540
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
Any idea what could be wrong here?
[EDIT]
I just tried the suggestion by #kgangadhar , but the result is the same:
$ sudo npm install -g process-nextick-args
module.js:540
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
Meteor 1.3.2.4.
I got this error everytime I try to meteor run / meteor run ios-device a project with cordova-ios.
Log:
/Users/admin/Desktop/My-App/.meteor/local/build/programs/server/boot.js:324
}).run();
^
Error: Cannot find module './util.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/admin/.meteor/packages/babel-compiler/.6.6.4.1vgwjcg++os+web.browser+web.cordova/npm/node_modules/meteor-babel/cache.js:4:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Do you have any thoughts what can cause that issue?
UPDATE: This happens only on MAC, on WIN everything works.
Re-installing Meteor solved this issue.
I have js2coffee installed globally and I tried
js2coffee app.js > app.coffee
And I got the following error
module.js:340
throw err;
^
Error: Cannot find module 'nopt'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/js2coffee/out/lib/command.js:16:10)
at Object.<anonymous> (/usr/lib/node_modules/js2coffee/out/lib/command.js:273:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/js2coffee/out/bin/js2coffee:2:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Does anyone know how to fix this?
It appears that the nopt module is a devDependency of js2coffee and isn't installed during production.
To fix this, navigate to js2coffee's module folder and run npm install. That will also install development dependencies, although I'm not sure why js2coffee needs them the way you're using it.
So if you're using running a Linux machine, use these commands:
cd /usr/lib/node_modules/js2coffee
npm install
It seems like you installed the package globally using -g option.Try installing the package like
npm install package
in the project directory
I just installed node-postgres by running npm install pg .
In my source code, I added var pg = require('pg");
and when I run I now get
module.js:340
throw err;
^
Error: Cannot find module 'pg'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/rrazavipour-lp/Documents/workspace/Astute/app.js:9:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain [as _onTimeout] (module.js:497:10)
What step am I missing?
Where is the node_modules folder in relation to your application?
from http://nodejs.org/api/modules.html:
If the module identifier passed to require() is not a native module, and does not begin with '/', '../', or './', then node starts at the parent directory of the current module, and adds /node_modules, and attempts to load the module from that location.