node global npm packages broke somehow (mac)
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
/usr/local/lib/lib
└── express@4.17.1But on the system the modules are in:
$ npm root -g
/usr/local/lib/lib/node_modules
$ 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 npmMy PATH:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/usr/local/lib
$ echo $NODE_PATH
/usr/local/binSystem:
macOS Mojave 10.14.5 (18F132)
Problem:
$ express
-bash: express: command not foundI installed the package just using:
$ npm install express -g -loglevel=infoWithout 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?
11 Answer
- 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!