今天clone一个项目从svn上,使用npm install下载依赖库频繁出错,折腾后,总结如下。
问题1
Error: EPERM: operation not permitted
具体错误信息如下:
42984 error Error: EPERM: operation not permitted, unlink 'C:\Users\Administrator\Desktop\frontend\plateform-frontend\node_modules\.staging\antd-ff30095a\dist\antd.js'
42984 error { Error: EPERM: operation not permitted, unlink 'C:\Users\Administrator\Desktop\frontend\plateform-frontend\node_modules\.staging\antd-ff30095a\dist\antd.js'
42984 error cause:
42984 error { Error: EPERM: operation not permitted, unlink 'C:\Users\Administrator\Desktop\frontend\plateform-frontend\node_modules\.staging\antd-ff30095a\dist\antd.js'
42984 error errno: -4048,
42984 error code: 'EPERM',
42984 error syscall: 'unlink',
42984 error path:
解决办法:
删除 C:\Users\用户名.npmrc
问题2
verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...
详细错误日志如下:
4179 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...rma-sinon":"^1.0.5","'
4179 verbose stack at JSON.parse (<anonymous>)
4179 verbose stack at parseJson (C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
4179 verbose stack at consumeBody.call.then.buffer
解决办法:
运行 npm cache clean --force
终结解决办法
如上面还不行:
可能是你连接npm库网络slow,请更换镜像为国内镜像:
淘宝镜像:npm config set registry https://registry.npm.taobao.org
cnpmjs镜像:npm config set registry http://r.cnpmjs.org/
然后如下进行:
1)删除C:\Users\用户名.npmrc
2)运行 npm cache clean --force
3)运行 cnpm install
解决完成,cnpm install没有问题,但是在npm start时报错,如下:
The ‘decorators’ plugin requires a ‘decoratorsBeforeExport’ option, whose value must be a boolean.
这个是由于ant design pro的问题,你必须使用npm来解决:
npm set registry https://registry.npmjs.org/
rm -rf node_modules/
npm cache clean --force
npm cache verify
npm install
如果还不行,我也只能帮你到这里了,剩下的路,大侠请走好