简体   繁体   中英

Error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1 while isntalling Node on my project

I'm trying to execute the command inside the root folder of a spring project: npm install natives@1.1.6

The problem is that each time that I execute the command I get an error (shown bellow “error-natives”) no matter what I try.

C:\Users\USER1\git\projec-web>npm install natives@1.1.6
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.

> deasync@0.1.4 install C:\Users\USER1\git\projec-web\node_modules\deasync
> node ./build.js

C:\Users\USER1\git\projec-web\node_modules\deasync>if not defined npm_config_node_gyp (node "C:\Users\USER1\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\USER1\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Los proyectos de esta solución se van a compilar de uno en uno. Para habilitar la compilación en paralelo, agregue el modificador "/m".
  deasync.cc
  win_delay_load_hook.cc
c:\users\USER1\git\projec-web\node_modules\nan\nan_converters_43_inl.h(22): warning C4996: 'v8::Value::ToBoolean': was d
eclared deprecated (compiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\d
easync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(2665): note: see declaration of 'v8::Value::ToBo
  olean' (compiling source file ..\src\deasync.cc)
c:\users\USER1\git\projec-web\node_modules\nan\nan_converters_43_inl.h(40): warning C4996: 'v8::Value::BooleanValue': wa
s declared deprecated (compiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\buil
d\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(2703): note: see declaration of 'v8::Value::Bool
  eanValue' (compiling source file ..\src\deasync.cc)
c:\users\USER1\git\projec-web\node_modules\nan\nan_implementation_12_inl.h(105): error C2664: 'v8::MaybeLocal<v8::Functi
on> v8::Function::New(v8::Local<v8::Context>,v8::FunctionCallback,v8::Local<v8::Value>,int,v8::ConstructorBehavior,v8::
SideEffectType)': cannot convert argument 1 from 'v8::Isolate *' to 'v8::Local<v8::Context>' (compiling source file ..\
src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  c:\users\USER1\git\projec-web\node_modules\nan\nan_implementation_12_inl.h(105): note: No constructor could take the s
  ource type, or constructor overload resolution was ambiguous (compiling source file ..\src\deasync.cc)

c:\users\USER1\git\projec-web\node_modules\nan\nan_implementation_12_inl.h(337): error C2660: 'v8::StringObject::New': f
unction does not take 1 arguments (compiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\
deasync\build\deasync.vcxproj]
c:\users\USER1\git\projec-web\node_modules\nan\nan_implementation_12_inl.h(337): error C2228: left of '.As' must have cl
ass/struct/union (compiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\dea
sync.vcxproj]
c:\users\USER1\git\projec-web\node_modules\nan\nan_implementation_12_inl.h(337): error C2059: syntax error: ')' (compili
ng source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1063): error C2661: 'v8::Value::ToString': no overloaded function t
akes 0 arguments (compiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\dea
sync.vcxproj]
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1073): error C2664: 'int v8::String::WriteUtf8(v8::Isolate *,char *
,int,int *,int) const': cannot convert argument 1 from 'char *' to 'v8::Isolate *' (compiling source file ..\src\deasyn
c.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1073): note: Types pointed to are unrelated; conversion requires
  reinterpret_cast, C-style cast or function-style cast (compiling source file ..\src\deasync.cc)
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1847): warning C4996: 'v8::Object::Set': was declared deprecated (c
ompiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(3499): note: see declaration of 'v8::Object::Set
  ' (compiling source file ..\src\deasync.cc)
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1853): warning C4996: 'v8::Object::Set': was declared deprecated (c
ompiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(3499): note: see declaration of 'v8::Object::Set
  ' (compiling source file ..\src\deasync.cc)
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1859): warning C4996: 'v8::Object::Set': was declared deprecated (c
ompiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(3508): note: see declaration of 'v8::Object::Set
  ' (compiling source file ..\src\deasync.cc)
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1865): warning C4996: 'v8::Object::Get': was declared deprecated (c
ompiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]

C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(3553): note: see declaration of 'v8::Object::Get
  ' (compiling source file ..\src\deasync.cc)
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1871): warning C4996: 'v8::Object::Get': was declared deprecated (c
ompiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(3553): note: see declaration of 'v8::Object::Get
  ' (compiling source file ..\src\deasync.cc)
C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1876): warning C4996: 'v8::Object::Get': was declared deprecated (c
ompiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_modules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(3557): note: see declaration of 'v8::Object::Get
  ' (compiling source file ..\src\deasync.cc)
c:\users\USER1\git\projec-web\node_modules\nan\nan_object_wrap.h(24): error C2039: 'IsNearDeath': is not a member of 'Na
n::Persistent<v8::Object,v8::NonCopyablePersistentTraits<T>>' [C:\Users\USER1\git\projec-web\node_modules\deasync\build\
deasync.vcxproj]
          with
          [
              T=v8::Object
          ] (compiling source file ..\src\deasync.cc)
  C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1888): note: see declaration of 'Nan::Persistent<v8::Object,v8::N
  onCopyablePersistentTraits<T>>'
          with
          [
              T=v8::Object
          ] (compiling source file ..\src\deasync.cc)
c:\users\USER1\git\projec-web\node_modules\nan\nan_object_wrap.h(67): warning C4996: 'v8::PersistentBase<v8::Object>::Ma
rkIndependent': was declared deprecated (compiling source file ..\src\deasync.cc) [C:\Users\USER1\git\projec-web\node_mo
dules\deasync\build\deasync.vcxproj]
  C:\Users\USER1\AppData\Local\node-gyp\Cache\12.18.3\include\node\v8.h(566): note: see declaration of 'v8::PersistentBa
  se<v8::Object>::MarkIndependent' (compiling source file ..\src\deasync.cc)
c:\users\USER1\git\projec-web\node_modules\nan\nan_object_wrap.h(124): error C2039: 'IsNearDeath': is not a member of 'N
an::Persistent<v8::Object,v8::NonCopyablePersistentTraits<T>>' [C:\Users\USER1\git\projec-web\node_modules\deasync\build
\deasync.vcxproj]
          with
          [
              T=v8::Object
          ] (compiling source file ..\src\deasync.cc)
  C:\Users\USER1\git\projec-web\node_modules\nan\nan.h(1888): note: see declaration of 'Nan::Persistent<v8::Object,v8::N
  onCopyablePersistentTraits<T>>'
          with
          [
              T=v8::Object
          ] (compiling source file ..\src\deasync.cc)

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\USER1\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USER1\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\USER1\git\projec-web\node_modules\deasync
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok   


Build failed
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! deasync@0.1.4 install: `node ./build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the deasync@0.1.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\USER1\AppData\Roaming\npm-cache\_logs\2020-09-06T07_52_53_788Z-debug.log

C:\Users\USER1\git\projec-web>

To clarify a little bit, I need to execute the command inside an spring boot project so I can communicate the angular module with the backend java module. The project is called “project-web” and it is compiled in the node version 1, and sadly I can't change it because of the requirements of some of the libraries. Has anything to do with the problem that I execute the npm install or the command npm install natives@1.1.6 inside the project root folder? I've noticed that when I execute any of these three commands it gives me the same error:

- npm install natives@1.1.6
- npm install
- npm install -g @angular/cli 

What I tried to do is:

  1. execute with administrator priviledges the following command: npm install --global --production windows-build-tools it successfully installed the dependencies
  2. execute the command natives with the error detailed above: npm install natives@1.1.6 here I got my error. I've been searching all over the internet but I'm unable to find a solution that helps me.

I tried to fix the following: node "C:\Users\USER1\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild

This works only if I edit the binding.gpy file with the content explained in this link: https://github.com/nodejs/node-gyp/issues/119 Also adding the binding.cc file in the src file, that heped me to perform the rebuild command.

I've also tried to follow this solution but it didn't helped me, because I end up allwas in the same error written above. 在此处输入图像描述 I went to the directory (C:\Users\USER1\AppData\Roaming\npm\node_modules\npm) and executed the command successfully: Npm install node-gyp

After that I execute: npm config set msvs_version 2015 –global

And when I try to execute the following command I get the same error detailed above: npm install deasync

My actual configuration is:

msvs_version = "2015"
python = "C:\\Users\\USER1\\.windows-build-tools\\python27\\python.exe"
prefix = "C:\\Users\\USER1\\AppData\\Roaming\\npm"
python version: 2.7.18
node version: v12.18.3
java version: "1.8.0_261"
my machine: windows 10 x64

PLEASE don't mark this question as duplicate because it is a different question based on deploying the node dependencies inside a proyect usigna sepcific version, this issue is not covered in previous questions

I provide the flowing links that I've checked but didn't helped me:

https://html.developreference.com/article/11494072/gyp+ERR.+stack+Error%3A+%60C%3A+Program+Files+(x86)+MSBuild+14.0+bin+msbuild.exe%60

Node-gyp. MSBuild.exe` failed with exit code: 1

gyp ERR: stack Error: `C.\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild:exe` failed with exit code: 1

Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1 gyp ERR: stack Error: `C.\Program Files (x86)\MSBuild\12.0\bin\msbuild:exe` failed with exit code: 1

gyp ERR: stack Error: `C.\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe`

gyp ERR: stack Error: `C.\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe`

https://github.com/nodejs/node-gyp/issues/2033

https://github.com/nodejs/node-gyp/issues/1859

gulp - internalBinding is not defined

UPDATE 1 I've tried to do what Perry Qian MSFT told me but I''ve get the same error, I'll try another thing and I'll let you know the result.

UPDATE 2 I made al walkaround to solve the issue for the moment but I don`t know if this can be considered a solution. I've seen in this link ( Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1 ) that some people tried a downgrade in the node version, I was using originally the version 12 and some say that with version 10 should work. After that I can perform the four steps provided in the answer:

run: npm cache clean --force

1. delete node_modules

2. delete packagelock.json and yarn.lock(if have)

3. run: npm install

First I need to downgrade my node version so I followed this documentation ( https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47 )

The first thing is to install nvm in windows so please go to the following link ( https://github.com/coreybutler/nvm-windows/releases ) and download the nvm-setup.zip file, unzip it and execute it and follow the installation steps. Then install the version 10, use the command: nvm install 10.16.3 After that ensure which version of nvm is launched in your machine, with the command: nvm list (in my case returned two results that where version 12.18.3 (currently using…) and the 10.16.3. Change to the version 10 using the command: nvm use 10.16.3

I've followed the steps but in order to get npm install or the npm install natives@1.1.6 command back to work, so I executed the command npm install natives@1.1.6 again and it worked giving me some traces:

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 16 packages from 21 contributors, removed 2 packages and audited 1949 packages in 92.167s

Technically speaking this is not an answer because the version 12 should work in the same way as the version 10. I would investigate further next week in order to provide a real solution.

My walkaround to this problema is detailed in the update 2, but it's basically what I explained here: I've seen in this link (Error: C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe failed with exit code: 1) that some people tried a downgrade in the node version, I was using originally the version 12 and some say that with version 10 should work. After that I can perform the four steps provided in the answer:

for me once I have updated the npm to latest version this issue resolved

npm install npm@latest -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM