安装npm包的时候报错rollbackFailedOptional: verb npm-session

报这个问题是因为npm代理的问题,解决办法:
 
1. 可以临时使用淘宝镜像
npm --registry https://registry.npm.taobao.org install 你想安装的npm包名称
 
解析:registry是npm 模块仓库提供了一个查询服务,叫做 registry 。以 npmjs.org 为例,它的查询服务网址是 https://registry.npmjs.org/ 。通过 https://registry.npm.taobao.org这个服务网址 进行npm包的安装,没有代理问题,可正常安装
 
2. 安装淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install 你想安装的npm包名称
然后就可以像使用npm一样使用cnpm进行安装了
posted @ 2019-05-18 17:04  生命岂能苟且  阅读(7844)  评论(0编辑  收藏  举报