简体   繁体   中英

Globally installed NPM packages not recognised

I had a system crash. While trying to fix it, I deleted a few files and (I may be wrong here), I deleted ~/.profile file among them.

After system restore, my globally installed npm packages are not working.

I uninstalled npm and node and installed the latest version of nodejs 16.x, and then reinstalled globally required npm packages, however, they are still not working. Somewhere the environment variables (in .profile file?) have gone missing.

How can I get the globally installed packages to run?

You are missing the path to the globally installed npm modules in your PATH . There are multiple fixes described on this page , one of which:

Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM