npm安装失败
在执行 npm install
时,出现如下错误,
npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js
1
2
3
4
5
6
7
2
3
4
5
6
7
一般出现类似的情况都是由于网络不好,可以通过****修改镜像来解决, 还可以在命令后加参数 --ignore-scripts
npm install --ignore-scripts
1
注意此参数会忽略脚本node install.js
的执行,如果你的要依赖此脚本下载的内容,这也不是好的办法。
如果觉得安装速度慢,安装源和原来 npm 是一样的,可以通用,修改方法如下:
yarn config get registry
# -> https://registry.yarnpkg.com
1
2
2
可以改成 taobao 的源:
yarn config set registry https://registry.npm.taobao.org
# -> yarn config v0.15.0
# -> success Set "registry" to "https://registry.npm.taobao.org".
# -> Done in 0.04s.
1
2
3
4
2
3
4
一定注意源地址不能带引号
nrm轻松切换镜像源
安装
npm i nrm -g
1
使用
$ nrm -h
Usage: cli [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
ls List all the registries
current Show current registry name
use <registry> Change registry to registry
add <registry> <url> [home] Add one custom registry
del <registry> Delete one custom registry
home <registry> [browser] Open the homepage of registry with optional browser
test [registry] Show response time for specific or all registries
help Print this help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
npm 报发布注意事项
1.如果使用了淘宝源 要切回到默认的npm源 建议使用mrn切换
2.如果发布包的时候提示权限不足(windows) 请使用管理员权限打开cmd 登录npm
npm login
1