Install NPM into home directory with distribution nodejs package (Ubuntu)

后端 未结 8 1671
忘了有多久
忘了有多久 2020-12-07 06:38

I\'d like to use the distribution Node.js packages (or the chris-lea ppa for more recent releases) but install NPM to my home directory.

This may seem picky, but it

8条回答
  •  情书的邮戳
    2020-12-07 07:20

    Other answers have outdated solutions: 2020's solution is using NPM_CONFIG_PREFIX environment variable. (See details)

    For example,

    $ NPM_CONFIG_PREFIX="$HOME/.npm-packages" npm install -g ios-sim
    /Users//.npm-packages/bin/ios-sim -> /Users//.npm-packages/lib/node_modules/ios-sim/bin/ios-sim
    + ios-sim@9.0.0
    added 108 packages from 68 contributors in 3.094s
    

提交回复
热议问题