简体   繁体   中英

nvm or npm, installing packages

I go to ~/tmp

when I do npm install eslint

  • on one system

it's installed ~/.nvm/versions/node/v10.17.0/lib/node_modules/eslint (and it's found via which eslint because ~/.nvm/.. is included in my PATH )

  • on another system it's installed ~/tmp/node_modules/eslint where I'm running the npm install command

Both systems have nvm, and both have nvm setup script in the zshrc file

export NVM_DIR="/Users/eugenekim/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

It depends, nvm stands for node version manager. This means you can have multiple versions of node on you device at the same time. npm stands for Node package manager . npm comes with Node.js and allows you to install Javascript packages. So to answer your question, you should use npm UNLESS you want a SEPARATE version of Node.js for your package, which I don't think you need.

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