Open saper opened 4 years ago
I'm using sass
instead it is the only reliable way for VSCode as it prebuilds packages and do not recompile them as you're changing node version.
@saper, I was facing a similar problem right now. I saw that node-sass try to download a pre-compiled binary from Github respecting the supported node version.
In my case, I was trying to install node-sass@4.9.3
(which supports node version 10) and my node version is 12. What I did was to manually download the .node file from the latest release (which supports my node version) and put it at npm-cache\node-sass\4.9.3.
After this I was able to npm install
without problems. But I think that downgrading your node could solve this problem as well.
Thanks @jvretamero - in your case you need to figure out which part of your project keeps node-sass version low (for example by requiring ^4.9
). Sometimes one has to find the project and ask them to update the dependency, like I did here for Pinafore:
https://github.com/nolanlawson/pinafore/pull/1625
If there is no matching binary, your system will fall back into compilation - and it might run into this issue we have here.
This is has been going on for months. Apparently it's never going to be fixed. Node-Sass is locked to a super old version of node-gyp. I'm trying to figure out how to remove node-sass from my Angular build - I'll never use it again.
As things currently stand, this workaround might work: https://github.com/nodejs/node-gyp/issues/1753#issuecomment-496024604 . Or it might not, it's completely unsupported.
@saper please consider removing the requirement for an explicit version of node-gyp
. If I understand correctly, the problem with using new versions of node-gyp
is that support for Node.js < 6 was dropped. Anyone willing to use an ancient version of Node.js with known vulnerabilities should also be willing to use an old version of node-sass
, and versions of Node.js < 10 should not be recommended anywhere. There are frequent issues on the node-gyp
issue tracker about this (example), but nothing can be done there since new versions already fix the problem.
As things currently stand, this workaround might work: nodejs/node-gyp#1753 (comment) . Or it might not, it's completely unsupported.
It worked for me to get around the
node-gyp
build errors re: MSBuild. Used the following npm config to get a good build with VS2019 Pro installed locally.npm config set msvs_version 2017 npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
I have the similar issue, I got the following errors.
gyp verb command build []
gyp verb download using dist-url https://npm.taobao.org/dist
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\Liu.D.H\.node-gyp\14.8.0
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build/binding.sln',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:468:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\code\\graphql\\vue-graphql-node\\client\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\code\graphql\vue-graphql-node\client\node_modules\node-sass
gyp ERR! node -v v14.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
In my computer, The path C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
does not exist, the correct path for it is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
.
Maybe an update of node-gyp
could fix this path issue.
When installing Visual Studio 2017 C++ Build Tools v141 using Visual Studio Installer, I was able to make this install, even when running latest Visual Studio, with no additional configuration required.
As things currently stand, this workaround might work: nodejs/node-gyp#1753 (comment) . Or it might not, it's completely unsupported.
It worked for me to get around the
node-gyp
build errors re: MSBuild. Used the following npm config to get a good build with VS2019 Pro installed locally.npm config set msvs_version 2017 npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
You Sir , Are a goooooood man ,You saved me afte i wasted 6+hours to fix this issue,I wish i had found your post earlier
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\MSBuild.exe gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\MSBuild.exe gyp info spawn args [ gyp info spawn args 'build/binding.sln', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] gyp ERR! UNCAUGHT EXCEPTION gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\MSBuild.exe ENOENT gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19) gyp ERR! stack at onErrorNT (internal/child_process.js:465:16) gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21) gyp ERR! System Windows_NT 10.0.18363
facing the same issue.
I'm trying to create a new VueJS project and when I add the node-sass (and only in that case) I also get this error. This is my full logs of the issue:
npm ERR! code 1 npm ERR! path F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js npm ERR! Building: C:\Program Files\nodejs\node.exe F:\SoftwareProjects\synagogue-vuetify\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm ERR! gyp info it worked if it ends with ok npm ERR! gyp verb cli [ npm ERR! gyp verb cli 'C:\Program Files\nodejs\node.exe', npm ERR! gyp verb cli 'F:\SoftwareProjects\synagogue-vuetify\node_modules\node-gyp\bin\node-gyp.js', npm ERR! gyp verb cli 'rebuild', npm ERR! gyp verb cli '--verbose', npm ERR! gyp verb cli '--libsass_ext=', npm ERR! gyp verb cli '--libsass_cflags=', npm ERR! gyp verb cli '--libsass_ldflags=', npm ERR! gyp verb cli '--libsass_library=' npm ERR! gyp verb cli ] npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@15.6.0 | win32 | x64 npm ERR! gyp verb command rebuild [] npm ERR! gyp verb command clean [] npm ERR! gyp verb clean removing "build" directory npm ERR! gyp verb command configure [] npm ERR! gyp verb check python checking for Python executable "python2" in the PATH npm ERR! gyp verb
which
failed Error: not found: python2 npm ERR! gyp verbwhich
failed at getNotFoundError (F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:13:12) npm ERR! gyp verbwhich
failed at F (F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:68:19) npm ERR! gyp verbwhich
failed at E (F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:80:29) npm ERR! gyp verbwhich
failed at F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:89:16 npm ERR! gyp verbwhich
failed at F:\SoftwareProjects\synagogue-vuetify\node_modules\isexe\index.js:42:5 npm ERR! gyp verbwhich
failed at F:\SoftwareProjects\synagogue-vuetify\node_modules\isexe\windows.js:36:5 npm ERR! gyp verbwhich
failed at FSReqCallback.oncomplete (node:fs:194:21) npm ERR! gyp verbwhich
failed python2 Error: not found: python2 npm ERR! gyp verbwhich
failed at getNotFoundError (F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:13:12) npm ERR! gyp verbwhich
failed at F (F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:68:19) npm ERR! gyp verbwhich
failed at E (F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:80:29) npm ERR! gyp verbwhich
failed at F:\SoftwareProjects\synagogue-vuetify\node_modules\which\which.js:89:16 npm ERR! gyp verbwhich
failed at F:\SoftwareProjects\synagogue-vuetify\node_modules\isexe\index.js:42:5 npm ERR! gyp verbwhich
failed at F:\SoftwareProjects\synagogue-vuetify\node_modules\isexe\windows.js:36:5 npm ERR! gyp verbwhich
failed at FSReqCallback.oncomplete (node:fs:194:21) { npm ERR! gyp verbwhich
failed code: 'ENOENT' npm ERR! gyp verbwhich
failed } npm ERR! gyp verb check python checking for Python executable "python" in the PATH npm ERR! gyp verbwhich
succeeded python C:\Python27\python.EXE npm ERR! gyp verb check python versionC:\Python27\python.EXE -c "import sys; print "2.7.18 npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"
returned: %j npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 15.6.0 npm ERR! gyp verb command install [ '15.6.0' ] npm ERR! gyp verb install input version string "15.6.0" npm ERR! gyp verb install installing version: 15.6.0 npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed npm ERR! gyp verb install version is already installed, need to check "installVersion" npm ERR! gyp verb got "installVersion" 9 npm ERR! gyp verb needs "installVersion" 9 npm ERR! gyp verb install version is good npm ERR! gyp verb get node dir target node version installed: 15.6.0 npm ERR! gyp verb build dir attempting to create "build" dir: F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\build npm ERR! gyp verb build dir "build" dir needed to be created? F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\build npm ERR! gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.18362 npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64 npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.VC.MSBuild.Base npm ERR! gyp verb find vs2017 - Using this installation with Windows 10 SDK npm ERR! gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community npm ERR! gyp verb build/config.gypi creating config file npm ERR! gyp verb build/config.gypi writing out config file: F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\build\config.gypi npm ERR! gyp verb config.gypi checking for gypi file: F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\config.gypi npm ERR! gyp verb common.gypi checking for gypi file: F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\common.gypi npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs" npm ERR! gyp info spawn C:\Python27\python.EXE npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'F:\SoftwareProjects\synagogue-vuetify\node_modules\node-gyp\gyp\gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'msvs', npm ERR! gyp info spawn args '-G', npm ERR! gyp info spawn args 'msvs_version=2015', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\build\config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'F:\SoftwareProjects\synagogue-vuetify\node_modules\node-gyp\addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\Users\OmriYaHoo\.node-gyp\15.6.0\include\node\common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\OmriYaHoo\.node-gyp\15.6.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=F:\SoftwareProjects\synagogue-vuetify\node_modules\node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=C:\Users\OmriYaHoo\.node-gyp\15.6.0\<(target_arch)\node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass\build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp verb command build [] npm ERR! gyp verb build type Release npm ERR! gyp verb architecture x64 npm ERR! gyp verb node dev dir C:\Users\OmriYaHoo.node-gyp\15.6.0 npm ERR! gyp verb found first Solution file build/binding.sln npm ERR! gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'build/binding.sln', npm ERR! gyp info spawn args '/nologo', npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64' npm ERR! gyp info spawn args ] npm ERR! gyp ERR! UNCAUGHT EXCEPTION npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:19) npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:477:16) npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:81:21) npm ERR! gyp ERR! System Windows_NT 10.0.19042 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "F:\SoftwareProjects\synagogue-vuetify\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm ERR! gyp ERR! cwd F:\SoftwareProjects\synagogue-vuetify\node_modules\node-sass npm ERR! gyp ERR! node -v v15.6.0 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! This is a bug innode-gyp
. npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help: npm ERR! gyp ERR! https://github.com/nodejs/node-gyp/issues npm ERR! Build failed with error code: 7npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\OmriYaHoo\AppData\Local\npm-cache_logs\2021-01-21T19_30_56_518Z-debug.log
My machine has a brand new installation of Windows 10 20H2 build 19042.746 with all the build tools of Visual Studio 2019 installer installed. Other Versions: python: 2.7.18 node: 15.6.0 vue-cli: 4.5.10
The version of node-sass that is trying to be installed is 4.12.0
When installing Visual Studio 2017 C++ Build Tools v141 using Visual Studio Installer, I was able to make this install, even when running latest Visual Studio, with no additional configuration required.
You are so cool!!! love you so much!!!
As things currently stand, this workaround might work: nodejs/node-gyp#1753 (comment) . Or it might not, it's completely unsupported.
It worked for me to get around the
node-gyp
build errors re: MSBuild. Used the following npm config to get a good build with VS2019 Pro installed locally.npm config set msvs_version 2017 npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
As things currently stand, this workaround might work: nodejs/node-gyp#1753 (comment) . Or it might not, it's completely unsupported.
It worked for me to get around the
node-gyp
build errors re: MSBuild. Used the following npm config to get a good build with VS2019 Pro installed locally.npm config set msvs_version 2017 npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
This works for me and thank you.
Does anyone have a workaround for this? When I run yarn and it tries to compile node-sass, it throws an error. I know this is due to the deprecated node-gyp trying to use VS2019 to compile. I've installed the windows build tools for VS2017 and VS2015 but how do I get it to look there?
Originally posted by @nhustak in https://github.com/sass/node-sass/issues/2851#issuecomment-601220369