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

废话不多说,直接上图

102751_QsXN_2266517.png

最近把项目下过来,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
- assert-plus@1.0.0 node_modules/nrm/node_modules/dashdash/node_modules/assert-plus
- assert-plus@1.0.0 node_modules/nrm/node_modules/getpass/node_modules/assert-plus
- graceful-readlink@1.0.1 node_modules/nrm/node_modules/graceful-readlink
- jodid25519@1.0.2 node_modules/nrm/node_modules/jodid25519
- assert-plus@1.0.0 node_modules/nrm/node_modules/jsprim/node_modules/assert-plus
- assert-plus@1.0.0 node_modules/nrm/node_modules/sshpk/node_modules/assert-plus
/usr/local/lib
└─┬ nrm@1.0.2
  ├── commander@2.11.0
  ├── extend@3.0.1
  └─┬ request@2.83.0
    ├── aws-sign2@0.7.0
    ├── form-data@2.3.1
    ├─┬ har-validator@5.0.3
    │ ├─┬ ajv@5.2.3
    │ │ ├── fast-deep-equal@1.0.0
    │ │ └── json-schema-traverse@0.3.1
    │ └── har-schema@2.0.0
    ├─┬ hawk@6.0.2
    │ ├── boom@4.3.1
    │ ├─┬ cryptiles@3.1.2
    │ │ └── boom@5.2.0
    │ ├── hoek@4.2.0
    │ └── sntp@2.0.2
    ├─┬ http-signature@1.2.0
    │ ├── assert-plus@1.0.0
    │ ├─┬ jsprim@1.4.1
    │ │ ├── extsprintf@1.3.0
    │ │ └─┬ verror@1.10.0
    │ │   └── core-util-is@1.0.2
    │ └─┬ sshpk@1.13.1
    │   └── getpass@0.1.7
    ├─┬ mime-types@2.1.17
    │ └── mime-db@1.30.0
    ├── performance-now@2.1.0
    ├── qs@6.5.1
    ├── safe-buffer@5.1.1
    ├── tough-cookie@2.3.3
    └── uuid@3.1.0

➜  ~ 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 <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
➜  ~ 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值