Cannot find module 'shelljs' after installing shelljs with npm
See original GitHub issueI have installed shelljs with npm with no problems:
npm install shelljs -g
But when I try to import shelljs into my project I get the error:
var shell = require('shelljs');
Error: Cannot find module 'shelljs'
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 repl:1:2
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
I have trying installing shelljs both globally and locally. I am using OS X Mavericks 10.9.2. Npm lists shelljs as installed:
shelljs@0.2.6 /usr/local/lib/node_modules/shelljs
Issue Analytics
- State:
- Created 10 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Could not find module 'shelljs' - node.js - Stack Overflow
I found the solution that some reason the [-g] to install globally wasn't working. So what I did was installing the shelljs command...
Read more >shelljs - npm
Start using shelljs in your project by running `npm i shelljs`. There are 15781 other projects in the npm registry using shelljs.
Read more >8848 (Build: release.js fails to require shelljs/global) - jQuery UI
Error: Cannot find module 'shelljs/global'. Its installed in __release/node_modules . ... Just need to remove the cwd-argument to the npm-install exec call.
Read more >Node.js – Could not find module 'shelljs' - iTecNote
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under home/dave/src/server/ ?...
Read more >iOS platform upgrade fails - Google Groups
I had 4.1.2-0.22.10 installed. sudo npm update -g phonegap seemed to work, ... Error: Cannot find module 'shelljs'. at Function.Module.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What I had to do:
npm root -g
/Users/clintonmedbery/.nvm/versions/node/v6.5.0/lib/node_modules
export NODE_PATH=/Users/clintonmedbery/.nvm/versions/node/v6.5.0/lib/node_modules
npm install -g shx
instead of install shelljs (https://github.com/shelljs/shx/issues/24)Thanks for the insight. I updated my comment!