npm 安装phantomJS不成功及其解决办法

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

废话不多说,直接上图

npm 安装phantomJS不成功及其解决办法_第1张图片

最近把项目下过来,npm install grunt-cli以及npm install grunt 都执行成功,但是就npm install 时不成功,查看控制台是phantomJs安装不成功,之后各种重装系统以及安装vs,但是这样做还是会出现这个错误,哦对了,之前还有一个msbuild错误,那个是因为没有安装vs或者是python导致的,安装了就好了。

解决方法:

安装nrm,使用nrm把npm的源切换成国内的

➜  ~ sudo npm i nrm -g # 安装nrm
Password:
/usr/local/bin/nrm -> /usr/local/lib/node_modules/nrm/cli.js
- [email protected] node_modules/nrm/node_modules/dashdash/node_modules/assert-plus
- [email protected] node_modules/nrm/node_modules/getpass/node_modules/assert-plus
- [email protected] node_modules/nrm/node_modules/graceful-readlink
- [email protected] node_modules/nrm/node_modules/jodid25519
- [email protected] node_modules/nrm/node_modules/jsprim/node_modules/assert-plus
- [email protected] node_modules/nrm/node_modules/sshpk/node_modules/assert-plus
/usr/local/lib
└─┬ [email protected]
  ├── [email protected]
  ├── [email protected]
  └─┬ [email protected]
    ├── [email protected]
    ├── [email protected]
    ├─┬ [email protected]
    │ ├─┬ [email protected]
    │ │ ├── [email protected]
    │ │ └── [email protected]
    │ └── [email protected]
    ├─┬ [email protected]
    │ ├── [email protected]
    │ ├─┬ [email protected]
    │ │ └── [email protected]
    │ ├── [email protected]
    │ └── [email protected]
    ├─┬ [email protected]
    │ ├── [email protected]
    │ ├─┬ [email protected]
    │ │ ├── [email protected]
    │ │ └─┬ [email protected]
    │ │   └── [email protected]
    │ └─┬ [email protected]
    │   └── [email protected]
    ├─┬ [email protected]
    │ └── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    └── [email protected]

➜  ~ nrm # 查看使用方法

  Usage: nrm [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                Change registry to registry
    add   [home]  Add one custom registry
    del                Delete one custom registry
    home  [browser]    Open the homepage of registry with optional browser
    test [registry]              Show response time for specific or all registries
    help                         Print this help
➜  ~ nrm ls # 列出可用的npm源

* npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
  taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/

➜  ~ nrm use taobao # 使用淘宝的nrm源
                         verb config Skipping project config: /Users/dangjian/.

   Registry has been set to: https://registry.npm.taobao.org/

➜  ~

切换完后,删除你的node_modules文件夹,重新进行安装

Enjoy IT

转载于:https://my.oschina.net/alioveyu/blog/659119

你可能感兴趣的:(npm 安装phantomJS不成功及其解决办法)