Home > database >  Errors installing node-sass in Angular 6 project
Errors installing node-sass in Angular 6 project

Time:10-27

I've cloned a repo from an existing Angular 6 project and executed npm install. After a bunch of warnings about deprecated packages (not unexpected, given that the project was created several years ago using Angular 6), I get a bunch of errors:

npm ERR! code 1
npm ERR! path /Users/.../node_modules/ng-packagr/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh /var/folders/xx/41k1bd6j11j5zh2vl572rg0m0000gn/T/postinstall-e6df27d4.sh
npm ERR! Building: /usr/local/bin/node /Users/.../node_modules/ng-packagr/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR!

Etc...

Notably, node-sass is not listed in package.json as a dependency.

My version of npm is 8.15.0 and node is v16.17.0.

For what it's worth - I have python 2.7.18 installed.

I've read here that node-sass has been deprecated, and I should replace it with sass, however, since it's not listed in package.json, I don't know how to do that.

Thanks for your help!

CodePudding user response:

For Angular 6 using node v16 might be causing the problem. Please refer this table for Angular CLI ~ Angular ~ Node computability versions

Angular Compatibility Matrix

So according to this your local versions should be

  • Angular Cli - 6.0.8
  • Node - 8.9.4
  • Related