windows系统 nmp安装时 出错的解决办法

3 篇文章 0 订阅
1 篇文章 0 订阅

使用npm安装yeoman时出现了出现权限问题错误,问题解决后,第二个问题来了,当我npm install -g generator-angular 构建项目时,又出现类似权限问题,宝宝不开心了,

代码如下:有相似代码都可以参考

C:\Users\hld-ln>npm install -g yo
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm a
nd is now out of date with respect to npm
npm ERR! tar.unpack untar error C:\Users\hld-ln\AppData\Roaming\npm-cache\string
_decoder\0.10.31\package.tgz
npm ERR! tar.unpack untar error C:\Users\hld-ln\AppData\Roaming\npm-cache\util-d
eprecate\1.0.2\package.tgz
npm ERR! tar.unpack untar error C:\Users\hld-ln\AppData\Roaming\npm-cache\string
_decoder\0.10.31\package.tgz
\
> spawn-sync@1.0.15 postinstall C:\Users\hld-ln\AppData\Roaming\npm\node_modules
\yo\node_modules\tabtab\node_modules\inquirer\node_modules\external-editor\node_
modules\spawn-sync
> node postinstall

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\node.js\\node.exe" "D:\\node.js\\node_modules\\npm\\bin\\npm-
cli.js" "install" "-g" "yo"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! path C:\Users\hld-ln\AppData\Roaming\npm\node_modules\yo\node_modules\y
eoman-environment\node_modules\mem-fs\node_modules\vinyl-file\node_modules\strip
-bom-stream\node_modules\first-chunk-stream\node_modules\readable-stream\node_mo
dules\string_decoder\index.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open

npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\hld-ln\AppData\Ro
aming\npm\node_modules\yo\node_modules\yeoman-environment\node_modules\mem-fs\no
de_modules\vinyl-file\node_modules\strip-bom-stream\node_modules\first-chunk-str
eam\node_modules\readable-stream\node_modules\string_decoder\index.js'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, open 'C:\Users\hld-ln\AppDat
a\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\node_modules\mem-f
s\node_modules\vinyl-file\node_modules\strip-bom-stream\node_modules\first-chunk
-stream\node_modules\readable-stream\node_modules\string_decoder\index.js']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Users\\hld-ln\\AppData\\Roaming\\npm\\node_modules\\yo\\no
de_modules\\yeoman-environment\\node_modules\\mem-fs\\node_modules\\vinyl-file\\
node_modules\\strip-bom-stream\\node_modules\\first-chunk-stream\\node_modules\\
readable-stream\\node_modules\\string_decoder\\index.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\hld-ln\npm-debug.log

解决办法:

1:检测npm的全局模块的存放路径是不是没有配置好

配置方法:http://xiaoyaojones.blog.163.com/blog/static/28370125201351501113581/

这种方法解决了我第一个问题

2:第一个问题解决后,cdm 中输入 yo doctor 检测一下配置是不是有问题,是不是npm版本太老了(nodejs安装后会自动帮我们安装好npm,但他的版本多数不是最新的,需要cdm 中 输入 npm install -g npm 更新版本,我就是这里出毛病了)

以上办法最好在管理员权限下运行

暂时出现这2个问题。。。希望别在出现其他问题。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值