Jenkins发布报错,vue编译node环境出错,npm install

运维

2019-07-04

176

0

运行npm install

错误信息:Unable to save binary  Error: EACCES: permission denied, mkdir   

具体如下:

Unable to save binary /home/jenkins/workspace/web_uat_build/node_modules/node-sass/vendor/linux-x64-64 : { Error: EACCES: permission denied, mkdir '/home/jenkins/workspace/web_uat_build/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:753:3)
at sync (/home/jenkins/workspace/web_uat_build/node_modules/mkdirp/index.js:71:13)
at Function.sync (/home/jenkins/workspace/web_uat_build/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/home/jenkins/workspace/web_uat_build/node_modules/node-sass/scripts/install.js:114:11)
at Object. (/home/jenkins/workspace/web_uat_build/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path:
'/home/jenkins/workspace/web_uat_build/node_modules/node-sass/vendor' }
> node-sass@4.12.0 postinstall /home/jenkins/workspace/web_uat_build/node_modules/node-sass
> node scripts/build.js

 

 

 

由于Jenkins使用的root账户,还无法在目录下创建权限,这很不应该呢。

网上找了很多资料,而且需要用到国内的镜像源地址,通过自己的实践得出以下命令:

npm install --unsafe-perm=true --allow-root --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist

npm run build

 

 

发表评论

全部评论:0条

lmy233

努力工作学习生活的人呐~~

联系方式

神圣之子仅供学习交流
E-mail:limengyu233@163.com
github:https://github.com/lmy01