Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBuild.exe ENOENT #1864

Closed
liudonghua123 opened this issue Aug 23, 2019 · 9 comments
Closed

MSBuild.exe ENOENT #1864

liudonghua123 opened this issue Aug 23, 2019 · 9 comments
Labels
ERR! node-gyp -v < v10.x.x npm install -g npm Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952

Comments

@liudonghua123
Copy link

  • Node Version: 12.8.0
  • Platform: Windows 10 1903
  • Compiler: VS2017、VS2019
  • Module: node-sass

I installed full VS2019 and visual 2017 C++ Build tools. I also tried the suggestions mentioned on #1747

npm install --global node-gyp@latest
for /f "delims=" %P in ('npm prefix -g') do npm config set node_gyp "%P\node_modules\node-gyp\bin\node-gyp.js"

But when I execute yarn to install dependences which include node-sass, I always got gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT even I set the config npm config set msvs_version 2017

The full log is

D:\code\weixin\sport-minapp\client>yarn
yarn install v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "eslint@^5.16.0".
warning " > [email protected]" has incorrect peer dependency "eslint@^5.16.0".
[4/4] Building fresh packages...
[-/3] ⡀ waiting...                                                              [-/3] ⡀ waiting...                                                              error D:\code\weixin\sport-minapp\client\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: D:\code\weixin\sport-minapp\client\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe D:\code\weixin\sport-minapp\client\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   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'D:\\code\\weixin\\sport-minapp\\client\\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] | win32 | 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 "C:\Python27\python.exe" in the PATH
gyp verb `which` succeeded C:\Python27\python.exe C:\Python27\python.exe
gyp verb check python version `C:\Python27\python.exe -c "import sys; print "2.7.15
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 12.8.0
gyp verb command install [ '12.8.0' ]
gyp verb install input version string "12.8.0"
gyp verb install installing version: 12.8.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 12.8.0
gyp verb build dir attempting to create "build" dir: D:\code\weixin\sport-minapp\client\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? D:\code\weixin\sport-minapp\client\node_modules\node-sass\build
gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
gyp verb find vs2017   - Found Microsoft.VisualStudio.Component.Windows10SDK.17763
gyp verb find vs2017   - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
gyp verb find vs2017   - Found Microsoft.VisualStudio.VC.MSBuild.Base
gyp verb find vs2017   - Using this installation with Windows 10 SDK
gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: D:\code\weixin\sport-minapp\client\node_modules\node-sass\build\config.gypi
gyp verb config.gypi checking for gypi file: D:\code\weixin\sport-minapp\client\node_modules\node-sass\config.gypi
gyp verb common.gypi checking for gypi file: D:\code\weixin\sport-minapp\client\node_modules\node-sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args   'D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-sass\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Liu.D.H\\.node-gyp\\12.8.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Liu.D.H\\.node-gyp\\12.8.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Liu.D.H\\.node-gyp\\12.8.0\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-sass',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\Liu.D.H\.node-gyp\12.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:264:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:77:11)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\code\\weixin\\sport-minapp\\client\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\code\weixin\sport-minapp\client\node_modules\node-sass
gyp ERR! node -v v12.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>
Build failed with error code: 7
                                                                                                                                                                
D:\code\weixin\sport-minapp\client>
@cclauss
Copy link
Contributor

cclauss commented Aug 24, 2019

https://stackoverflow.com/questions/43260643/how-to-resolve-nodejs-error-enoent-no-such-file-or-directory/50891794 ?

@liudonghua123
Copy link
Author

@cclauss I understand 'No such file or directory' error, but this issue is not just ENOENT error.
I have installed VS2017 and configure msvs_version to use 2017, but the installation still use the 2019.

@pixelvm
Copy link

pixelvm commented Aug 26, 2019

In my computer:

Right: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe

Wrong: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe

@chester0
Copy link

Was getting this too, to fix:
edit C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js
Line 159:

variables['msbuild_path'] = path.join(vsSetup.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe')

Change the '15.0' to 'Current'

@liudonghua123
Copy link
Author

@lntmny, @chester0 After I update node-gyp to 5.x, then I got no such errors.

@liudonghua123
Copy link
Author

I modified package.json, and add the following snippets.

  "resolutions": {
    "node-gyp": "5.0.3"
  }

Then install the dependencies via yarn, all the errors disappeared.

@ritu-raj-s
Copy link

In my computer:

Right: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe

Wrong: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe

How did you solve this? I am facing the
same issue

@satori-stan
Copy link

I have node-gyp 5.0.3 and the source lists the following environment variable to be an override for the path to MSBuild: GYP_MSVS_OVERRIDE_PATH.
After configuring the variable, the build finished as expected.

@cclauss
Copy link
Contributor

cclauss commented Jun 1, 2020

@cclauss cclauss added ERR! node-gyp -v < v10.x.x npm install -g npm Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952 labels Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ERR! node-gyp -v < v10.x.x npm install -g npm Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952
Projects
None yet
Development

No branches or pull requests

6 participants