Could not find module 'shelljs'

I found the solution that some reason the [-g] to install globally wasn't working. So what I did was installing the shelljs command in the project location as below.

Path To The Project\platforms\android\cordova

and then install "shelljs" at the location

npm install shelljs

Hope this help someone has the same issue.


For me worked setting first the NODE_PATH:

export NODE_PATH=$(npm root -g)
npm install -g shelljs

I use macOS and I had the same problem within one of the microservices we work on.

This error can persist even when we run the command npm run shelljs.

So, What I had to do was:

  • Delete node_modules folder in the project: rm -r -f node_modules
  • run npm install again
  • run npm build
  • finally: npm run start:dev

Problem solved succesfully ! :)