So I have node installed together with npm. And used the official installer from the website. But when I install a package globally like "express" for example it won't be available in command line.

Some information:

$ npm list -g --depth=0
└── express@4.17.1

But on the system the modules are in:

$ npm root -g

$ ll
total 0
drwxrwxrwx   5 rudolfchrispens  admin   160B Jul 18 11:19 .
drwxrwxrwx  75 rudolfchrispens  admin   2.3K Jul 18 11:23 ..
drwxr-xr-x   3 rudolfchrispens  admin    96B Jul 18 11:19 .staging
drwxr-xr-x   3 rudolfchrispens  admin    96B Jul 18 11:19 express
drwxr-xr-x  24 root             wheel   768B Jul  3 15:31 npm


$ echo $PATH

$ echo $NODE_PATH

macOS Mojave 10.14.5 (18F132)


$ express
-bash: express: command not found

I installed the package just using:

$ npm install express -g -loglevel=info

Without any errors...

What I already tried:

  • uninstall completly
  • rm all left files
  • reinstall with official installer
  • tried to change this property: 'npm config set prefix=/usr/local/lib' (since in some cases /usr/local/ seems to make problems because of rights

Any ideas what to try next?

  • You don’t have /usr/local/lib/bin in $PATH. I suggest you undo the prefix change that doesn’t adhere to established filesystem hierarchies. – Daniel B Jul 18 '19 at 9:50
  • thanks for your answer i fixed the problem now... – rufreakde Jul 18 '19 at 10:43
  • Removed everything by hand with a tutorial.
  • installed nvm via homebrew
  • installed node 12 via nvm
  • installed all my packages again (including npm install express-generator -g)
  • everything works again!
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.