My team recently upgraded to angular 7, and now i’m running into problems with node-sass
(but the same circle.yml
file works fine for my coworkers on circle).
Original yml:
- run:
name: Install Angular
command: sudo npm i @angular/cli -g
- run:
name: Install dependencies
command: sudo npm install
- run:
name: Node Sass
command: npm install node-sass@4.10.0
- run:
name: Rebuild Node Sass
command: sudo npm rebuild node-sass
and circle failed with:
#!/bin/bash -eo pipefail
npm i node-sass@4.10.0
npm WARN checkPermissions Missing write access to /home/circleci/cloud-frontend/node_modules
changing node-sass
command to npm install node-sass@4.10.0
, results in the following error:
#!/bin/bash -eo pipefail
sudo npm i node-sass@4.10.0
> node-sass@4.10.0 install /home/circleci/cloud-frontend/node_modules/node-sass
> node scripts/install.js
Unable to save binary /home/circleci/cloud-frontend/node_modules/node-sass/vendor/linux-x64-57 : { Error: EACCES: permission denied, mkdir '/home/circleci/cloud-frontend/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:885:18)
at sync (/home/circleci/cloud-frontend/node_modules/mkdirp/index.js:71:13)
at Function.sync (/home/circleci/cloud-frontend/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/home/circleci/cloud-frontend/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/home/circleci/cloud-frontend/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/home/circleci/cloud-frontend/node_modules/node-sass/vendor' }
then, with some research, i came along this doc, so I changed node-sass
command to sudo npm install --unsafe-perm -g node-sass@4.10.0
instead
this time, i finally passed the dependency stage, but tests failed with:
ERROR in ./src/app/shared/alert/alert.component.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
i’ve also tried other suggestions such as:
sudo npm rebuild node-sass --force
npm clean cache --force
- steps described in https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
but circle builds always fail at either the installation stage (permission denied) or test stage (no module node-sass
)