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

后端 未结 8 1679
忘了有多久
忘了有多久 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:44

    To expand on the answer provided by Just Jake and user1533401: I am unable to downgrade as I use shared hosting and node is installed in a system directory. This is also why I have change the directory where npm installs global scripts if I want it to do that. For those in the same boat, here is a another temporary fix I found works:

    npm install -g --prefix=$(npm config get prefix)

    The bug is that npm doesn't read your per-user config file, but specifying it every time you install a global script fixes that. Found here.

提交回复
热议问题