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 node-gyp@3.8.0
gyp info using node@13.9.0 | 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
Install node-sass globally with yarn
Or
Add node-sass to your project
Just upgrade your sass version in your yarn.lock file.
For node 14 the appropriate version for node-sass is 4.14.
So adapt to your node version.
Faced the same issue. If you look at the error stack, it says:
Error: Command failed: /usr/bin/python3.6 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
File "<string>", line 1
import sys; print "%s.%s.%s" % sys.version_info[:3];
^
SyntaxError: invalid syntax
It's trying to use Python2 but instead uses Python3 which is not supported.
My system runs Python3 when called using the python command, so I fixed this by installing Python2 and aliasing it to the python command:
alias python=pyhton2.7
I had the same issue upgraded the node-sass version to be the same as node version. with yarn just run:
yarn add node-sass
this will upgrade the version and fix the issue
I solved this issue by installing the python 2.7 version on windows os.I had Python 3 installed before. This error happens because of the python version 3.
my solution use node v10.19.0
https://github.com/nodejs/docker-node/issues/1149#issuecomment-552705885
Had a similar problem with /node_modules/node-sass: Command failed on building my application, which also occurred within the last week without any updates on my end.
Had a look at the node-sass docs and the node version on the server and it was using node v12.13.0 and the version of node-sass was 4.9.x.
in the node-sass release docs it lists that for node v12 you need to have node-sass v4.12 and up.
Updating node-sass version corrected the build for me, hope it helps for you too.
node Release docs: https://github.com/sass/node-sass/releases
Solutions here don't work for me. Until I delete the node_modules folder and yarn.lock.
rm -rf node_modules
rm yarn.lock
yarn instal
I ran into this issue when containerising a VueJs app. I was using the node:15.12.0-alpine tag as base image before but the issue was fixed once I changed to the full node image (node:15.12.0) that uses debian-stretch.
Try installing sass instead of node-sass. It worked well for me.
yarn remove node-sass
yarn add sass
sometimes not show correct error,update the node version and retry to install node-sass and sass-loader
I am running Rails 6 and for some reason it was pulling webpacker 4.3.0 which was pulling node-sass 4.3.0 rather than 6.0.0 which is the latest as of the date of this post.
What worked for me is the following:
node_module folder, package-lock.json and yarn.lockpackage.json, I upgraded rails/webpacker: 5.3.0.yarn install.yarn add node-sassThat worked like a charm, after trying everything else above.
I believe those were the exact steps, although to be honest I have been trying sooo many things and they didn't work and I finally got it to work so there is a possibility I may have missed a step, but I did my best to re-create it for any future frustrated soul out there.
It's failing because python3 is used here. Create a .npmrc file in the project folder containing python = "/usr/bin/python2.7" and install. According to link, python 3.x.x is not yet supported. – NaceurBouhamed Feb 25 '20 at 12:28
****python = "localpath/python27/python.exe"
RESOLVED
I had the same problem and I solved with the steps:
Rosetta 2 (optional, only necessary if you have the Node installed with Rosetta)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 |
node --versionnode-sass, if your are using NVM, run: nvm use DESIRED_VERSIONrm -rf node_modulesnpm installResource:
I changed the node version from 16.0 to 14.x in my package.json file and it worked.
Another option is to update your PATH environment variable to point to Python2 instead of Python3 (remove the Python3 directory from PATH)
With gulp I got "Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x
Found bindings for the following environments:
This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to download the binding for your current environment."
So I ran npm rebuild node-sass and that worked! Then npm install and everything went ok.
i have been facing the same problem for a while now on rails app, and was solved by upgrading webpacker:
# check your Gemfile for version restrictions
bundle update webpacker
# overwrite your changes to the default install files and revert any unwanted changes from the install
rails webpacker:install
# yarn 1 instructions
yarn upgrade @rails/webpacker --latest
yarn upgrade webpack-dev-server --latest
see: https://github.com/rails/webpacker#upgrading
props to chase439 : https://github.com/sass/node-sass/issues/2447
TBH my problem was that I tried to "npm install angular-cli" instead of "npm install @angular/cli", hope this helps other dummies like me :)
On top of the suggested resolutions, I've found that sometimes yarn.lock has a node-gyp locked version for node-sass.
When I changed it from 3.8.0 to 8.4.1 everything worked.
If it's Rails project, upgrading webpacker did the job for me.
yarn add @rails/webpacker
For Vue Storefront 1, you can try using node version 10.16.0 and it will work fine.
Got very strange solutions around after reading the heroku logs.
Initially I have added buildpacks into this order: heroku/ruby heroku/nodejs
But after looking into the complete log and error i have change the order: heroku/nodejs heroku/ruby
After that precompile works nicely.
For macOS users
If you need to use node-gyp from within npm (e.g. through npm install), you will have to install node-gyp (either globally with -g or to a predictable location) and tell npm where the new version is.
In my case, turns out my project defaulted to using node-gyp v3.8.0 to building my project's modules.
To remedy that, I ran the following commands:
npm config set node_gyp /usr/local/lib/node_modules/node-gyp
npm install
I hope this is insightful for anyone going through the same.
This happened to me a day after upgrading node. I had to revert to a lower node version. I had upgraded to 16.13.2 from 14.15.4