文章目录
- 一、报错信息
- 二、解决方法
一、报错信息
Unable to save binary /var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/vendor/freebsd-x64-48 : { Error: EACCES: permission denied, mkdir '/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.mkdirSync (fs.js:932:18)
at sync (/var/lib/jenkins/workspace/news-html5-test/node_modules/mkdirp/index.js:71:13)
at Function.sync (/var/lib/jenkins/workspace/news-html5-test/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/vendor' }
> node-sass@4.9.3 install /var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass
> node scripts/install.js
Unable to save binary /var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/vendor/freebsd-x64-48 : { Error: EACCES: permission denied, mkdir '/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.mkdirSync (fs.js:932:18)
at sync (/var/lib/jenkins/workspace/news-html5-test/node_modules/mkdirp/index.js:71:13)
at Function.sync (/var/lib/jenkins/workspace/news-html5-test/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/var/lib/jenkins/workspace/news-html5-test/node_modules/node-sass/vendor' }
二、解决方法
在npm instal之前添加如下脚本
npm config set user 0
npm config set unsafe-perm true
提示:更多内容可以访问Clang’s Blog:https://www.clang.asia