当前位置:网站首页>npm install

npm install

2022-04-22 06:18:00 Crazy snail

centos Default installation
[root@localhost ~]# yum -y install nodejs
[root@localhost ~]# node -v
v6.17.1
[root@localhost ~]# npm -v 
3.10.10

# see npm Warehouse address
npm get registry 
# change npm Warehouse address
npm config set registry https://registry.npmjs.org/
npm config set registry https://registry.npm.taobao.org

# Install the specified version on @ Add version number later , And you can specify the warehouse address
npm install -g [email protected] --registry=https://registry.npm.taobao.org


# npm -g install [email protected] --registry=https://registry.npm.taobao.org  ### The following is the error message
- [email protected] node_modules/npm/node_modules/asap
- [email protected] node_modules/npm/node_modules/fstream
- [email protected] node_modules/npm/node_modules/fstream-npm
- [email protected] node_modules/npm/node_modules/normalize-git-url
- [email protected] node_modules/npm/node_modules/realize-package-specifier
/usr/lib
└── (empty)

npm ERR! Linux 3.10.0-862.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "-g" "install" "[email protected]" "--registry=https://registry.npm.taobao.org"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules/npm/node_modules/columnify
npm ERR! code EEXIST
npm ERR! errno -17
npm ERR! syscall mkdir

npm ERR! EEXIST: file already exists, mkdir '/usr/lib/node_modules/npm/node_modules/columnify'
npm ERR! File exists: /usr/lib/node_modules/npm/node_modules/columnify
npm ERR! Move it away, and try again.
npm ERR! Linux 3.10.0-862.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "-g" "install" "[email protected]" "--registry=https://registry.npm.taobao.org"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! path npm-debug.log.3436820402
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.3436820402'
npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.3436820402'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/lib/node_modules/npm/node_modules.bundled/columnify/npm-debug.log
npm ERR! code 1
###npm Command failure

Unloading is required at this time rpm After package , reinstall
rpm -e npm-3.10.10-1.6.17.1.1.el7.x86_64  --nodeps
rpm -e nodejs-6.17.1-1.el7.x86_64

Delete npm Cache and module
npm cache clean --force
npm install rimraf -g
rimraf node_modules

notes : For this example root install , There is no permission problem , And failed to install many times

Download higher version node Of rpm Package installation
nodejs-10.24.1-1nodesource.x86_64.rpm
Download address :https://download.csdn.net/download/zhangxueleishamo/77848815

yum Source curl -sL https://rpm.nodesource.com/setup_10.x | bash -
yum clean all 
yum makecache fast

yum -y install nodejs-10.24.1-1nodesource.x86_64.rpm
[root@spug yum.repos.d]# node -v 
v10.24.1
[root@spug yum.repos.d]# npm -v
6.14.12

版权声明
本文为[Crazy snail]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220547471546.html