80

Вопрос по node.js – Установите NPM в домашний каталог с пакетом распространения nodejs (Ubuntu)

Я хотел бы использовать дистрибутивы Node.js (илиКрис-Леа PPA [https://launchpad.net/~chris-lea/+archive/node.js/]для более поздних выпусков), но установите NPM в мой домашний каталог. Это может показаться придирчивым, но для разработчиков, ...

Error: User Rate Limit Exceeded<a href="https://stackoverflow.com/questions/19352976/npm-modules-wont-install-globally-without-sudo" title="npm modules wont install globally without sudo">stackoverflow.com/questions/19352976/&#x2026;</a>

от Colonel Panic

7 ответов

1

Error: User Rate Limit Exceeded

npm install -g --prefix=$(npm config get prefix) <package>

Error: User Rate Limit ExceededError: User Rate Limit Exceeded.

187

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

 $ NPM_PACKAGES="$HOME/.npm-packages"
 $ mkdir -p "$NPM_PACKAGES"

Error: User Rate Limit Exceeded

 $ echo "prefix = $NPM_PACKAGES" >> ~/.npmrc

Error: User Rate Limit Exceeded

# NPM packages in homedir
NPM_PACKAGES="$HOME/.npm-packages"

# Tell our environment about user-installed node tools
PATH="$NPM_PACKAGES/bin:$PATH"
# Unset manpath so we can inherit from /etc/manpath via the `manpath` command
unset MANPATH  # delete if you already modified MANPATH elsewhere in your configuration
MANPATH="$NPM_PACKAGES/share/man:$(manpath)"

# Tell Node about these packages
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"

Error: User Rate Limit Exceedednpm install -gError: User Rate Limit Exceeded~/.npm-packages/lib/node_modulesError: User Rate Limit Exceeded~/.npm-packages/binError: User Rate Limit ExceededPATH.

Error: User Rate Limit Exceedednpm install -gError: User Rate Limit Exceeded

[[email protected]:~] $ npm install -g coffee-script
... (npm downloads stuff) ...
/home/justjake/.npm-packages/bin/coffee -> /home/justjake/.npm-packages/lib/node_modules/coffee-script/bin/coffee
/home/justjake/.npm-packages/bin/cake -> /home/justjake/.npm-packages/lib/node_modules/coffee-script/bin/cake
[email protected] /home/justjake/.npm-packages/lib/node_modules/coffee-script

[[email protected]:~] $ which coffee
/home/justjake/.npm-packages/bin/coffee
22

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Install Node.js with nvm (no sudo required):

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
source ~/.bashrc
nvm install 7
npm install -g npm  # update npm

Error: User Rate Limit Exceededinstall -gError: User Rate Limit ExceededsudoError: User Rate Limit Exceeded~/.nvm/

Or install Node.js without nvm (official instructions):

Install Node.js

  • Node.js v6 (current LTS as of May 2017):

    curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
  • Node.js v7:

    curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

Change npm's default directory to a local one:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH="$HOME/.npm-global/bin:$PATH"  # ← put this line in .bashrc
source ~/.bashrc  # if you only updated .bashrc

Error: User Rate Limit Exceeded.npm-globalError: User Rate Limit Exceeded

Update npm and check it is installed in your $HOME directory:

$ npm install npm -g
/home/<username>/.npm-global/bin/npm -> /home/<username>/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/<username>/.npm-global/lib
└─┬ [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  ├── [email protected] 
  └── [email protected] 

Error: User Rate Limit Exceededinstall -gError: User Rate Limit ExceededsudoError: User Rate Limit Exceeded

2

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceedednodejs.

Error: User Rate Limit Exceeded

  1. Install prerequisite packages for building nodejs:

    sudo apt-get update
    sudo apt-get install build-essential libssl-dev
    
  2. Install nvm:

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
    

    In case newer version of nvm will be available you can find actual installation command on nvm site.

  3. nvm installer will add bootstrap script to ~/.bashrc, so you need either to reopen terminal to run it, or to do:

    source ~/.bashrc
    
  4. Now you can install any nodejs version you like, switch between them etc.

    Use nvm ls-remote to list available nodejs versions.

    To install, for example, nodejs v4.2.4 do:

    # install v4.2.4
    nvm install v4.2.4 
    # use nodejs v4.2.4 in the current terminal session
    nvm use v4.2.4
    # use v4.2.4 by default in new terminal session
    nvm alias default v4.2.4
    
5

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded)

Error: User Rate Limit Exceeded

  1. Comment the prefix line in your $HOME/.npmrc
  2. Run sudo npm install -g [email protected]
  3. Ensure that the right version of npm is installed (npm --version)
  4. Uncomment the prefix line in your $HOME/.npmrc
  5. Proceed to install your global packages in your home folder!.
-1

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

npm config set prefix ~
echo export PATH=\$PATH:\~/bin >> ~/.bashrc
. ~/.bashrc
3

Error: User Rate Limit ExceededvirtualenvError: User Rate Limit ExceedednodeenvError: User Rate Limit ExceedednvmError: User Rate Limit Exceeded0.10Error: User Rate Limit Exceeded

ENVNAME=dev1

#  create an environment
python -m virtualenv ${ENVNAME}

# switch to the newly created env
source ${ENVNAME}/bin/activate

# install nodeenv
pip install nodeenv

# install system's node into virtualenv
nodeenv --node=system --python-virtualenv

Error: User Rate Limit ExceededError: User Rate Limit Exceeded

Похожие вопросы