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.

Cannot find module 'shelljs' after installing shelljs with npm

See original GitHub issue

I 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:closed
  • Created 10 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
clintonmedberycommented, May 13, 2019

What I had to do:

  1. Type in npm root -g
  2. It’ll return something like /Users/clintonmedbery/.nvm/versions/node/v6.5.0/lib/node_modules
  3. Take the path and export is as NODE_PATH: export NODE_PATH=/Users/clintonmedbery/.nvm/versions/node/v6.5.0/lib/node_modules
  4. Run npm install -g shx instead of install shelljs (https://github.com/shelljs/shx/issues/24)
1reaction
clintonmedberycommented, May 13, 2019

Thanks for the insight. I updated my comment!

Read more comments on GitHub >

github_iconTop 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 >

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