Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error /node_modules/node-sass: Command failed

When I tried install vue store front in my local but when I tried "yarn install" command I get following error. How can I solve this error? How can I solve this error?

error /var/www/html/vue-storefront/node_modules/node-sass: Command failed. Exit code: 1 Command: node scripts/build.js Arguments:  Directory: /var/www/html/vue-storefront/node_modules/node-sass Output: Building: /usr/bin/node /var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli   '/usr/bin/node', gyp verb cli   '/var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli   'rebuild', gyp verb cli   '--verbose', gyp verb cli   '--libsass_ext=', gyp verb cli   '--libsass_cflags=', gyp verb cli   '--libsass_ldflags=', gyp verb cli   '--libsass_library=' gyp verb cli ] gyp info using [email protected] gyp info using [email protected] | linux | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "/usr/bin/python3.6" in the PATH gyp verb `which` succeeded /usr/bin/python3.6 /usr/bin/python3.6 gyp ERR! configure error  gyp ERR! stack Error: Command failed: /usr/bin/python3.6 -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack   File "<string>", line 1 gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack                                ^ gyp ERR! stack SyntaxError: invalid syntax gyp ERR! stack  gyp ERR! stack     at ChildProcess.exithandler (child_process.js:303:12) gyp ERR! stack     at ChildProcess.emit (events.js:321:20) gyp ERR! stack     at maybeClose (internal/child_process.js:1026:16) gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) gyp ERR! System Linux 4.15.0-88-generic gyp ERR! command "/usr/bin/node" "/var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd /var/www/html/vue-storefront/node_modules/node-sass gyp ERR! node -v v13.9.0 
like image 803
Adil Avatar asked Feb 25 '20 12:02

Adil


People also ask

What is node sass?

Node sass is a library that allows binding for Node. js to LibSass, the C version of Sass's stylesheet preprocessor. It compiles . scss files to CSS with speed and automatically through connected middleware. SASS (Syntactically Awesome Style Sheets) is a comprehensive version of CSS.

How do I check Sass version?

To check the version, run the command: sass –version. The latest version is 1.49.

How do I install a specific version of node JS?

To install a specific version of Node, you need to run nvm list available first so you can see the versions of Node that are available. To install that specific version, run nvm install node-version-number . For example, nvm install 14.20.0 .

Is node Sass deprecated?

Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.


1 Answers

I had the same problem and I solved with the steps:

  1. if your are on Apple M1 Chip, run terminal with Rosetta 2 (optional, only necessary if you have the Node installed with Rosetta)
  2. check your node-sass version in your package.json and compare with the following table:
NodeJS Supported node-sass version Node Module
Node 16 6.0+ 93
Node 15 5.0+ 88
Node 14 4.14+ 83
Node 13 4.13+, <5.0 79
Node 12 4.12+ 72
Node 11 4.10+, <5.0 67
Node 10 4.9+, <6.0 64
Node 8 4.5.3+, <5.0 57
Node <8 <5.0 <57
  1. check your Node version with: node --version
  2. install the Nodejs version according with your node-sass, if your are using NVM, run: nvm use DESIRED_VERSION
  3. clean old node_modules deleting the folder or type this on terminal: rm -rf node_modules
  4. run: npm install

Resource:

  • https://www.npmjs.com/package/node-sass
like image 103
Ângelo Polotto Avatar answered Sep 22 '22 22:09

Ângelo Polotto