簡體   English   中英

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

[英]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

我正在嘗試在 spring 項目的根文件夾中執行命令:npm install natives@1.1.6

問題是每次我執行命令時,無論我嘗試什么,我都會得到一個錯誤(如下所示的“error-natives”)。

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>

為了澄清一點,我需要在 spring 引導項目中執行命令,這樣我就可以將 angular 模塊與后端 java 模塊通信。 該項目名為“project-web”,它是在節點版本 1 中編譯的,遺憾的是,由於某些庫的要求,我無法更改它。 與我在項目根文件夾中執行 npm 安裝或命令 npm install natives@1.1.6 的問題有關嗎? 我注意到,當我執行這三個命令中的任何一個時,它都會給我同樣的錯誤:

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

我試圖做的是:

  1. 以管理員權限執行以下命令: npm install --global --production windows-build-tools它成功安裝了依賴項
  2. 執行帶有上述錯誤的命令 natives: npm install natives@1.1.6在這里我得到了我的錯誤。 我一直在互聯網上搜索,但找不到對我有幫助的解決方案。

我嘗試修復以下問題: node "C:\Users\USER1\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" 重建

僅當我使用此鏈接中解釋的內容編輯 binding.gpy 文件時,這才有效: https://github.com/nodejs/node-gyp/issues/119還在 src 文件中添加 binding.cc 文件我執行重建命令。

我也嘗試遵循這個解決方案,但它沒有幫助我,因為我最終都陷入了上面寫的同樣的錯誤。 在此處輸入圖像描述 我進入目錄(C:\Users\USER1\AppData\Roaming\npm\node_modules\npm)並成功執行命令: Npm install node-gyp

之后我執行: npm config set msvs_version 2015 –global

當我嘗試執行以下命令時,我得到了上面詳述的相同錯誤: npm install deasync

我的實際配置是:

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

請不要將此問題標記為重復,因為它是基於在 proyect usigna sepcific 版本中部署節點依賴項的不同問題,此問題未包含在以前的問題中

我提供了我檢查過但沒有幫助我的流動鏈接:

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

節點吉普。 MSBuild.exe` 失敗,退出代碼:1

gyp ERR:堆棧錯誤:`C.\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild:exe` 失敗,退出代碼:1

錯誤:`C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` 失敗,退出代碼:1 gyp ERR:堆棧錯誤:`C.\Program Files (x86 )\MSBuild\12.0\bin\msbuild:exe` 失敗,退出代碼:1

gyp ERR:堆棧錯誤:`C.\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe`

gyp ERR:堆棧錯誤:`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 - 未定義內部綁定

更新 1 我已經嘗試按照 Perry Qian MSFT 告訴我的操作,但我遇到了同樣的錯誤,我會嘗試另一件事,我會告訴你結果。

更新 2 我暫時解決了這個問題,但我不知道這是否可以被認為是一個解決方案。 我在此鏈接中看到( 錯誤:`C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1 )有些人嘗試了在節點版本中降級,我最初使用的是版本 12,有人說版本 10 應該可以工作。 之后,我可以執行答案中提供的四個步驟:

運行:npm 緩存清理 --force

1. delete node_modules

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

3. run: npm install

首先我需要降級我的節點版本,所以我遵循了這個文檔( 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安裝步驟。 然后安裝版本 10,使用命令:nvm install 10.16.3 之后確保在您的機器上啟動了哪個版本的 nvm,使用命令:nvm list(在我的情況下返回兩個結果,版本 12.18.3(當前使用...) 和 10.16.3。使用以下命令更改為版本 10:nvm use 10.16.3

我已經按照這些步驟操作,但是為了讓 npm 安裝或 npm install natives@1.1.6 命令恢復工作,所以我執行了命令npm 並再次安裝了 natives@1.1.6。

npm WARN notsup 跳過可選依賴:fsevents@1.2.4 不受支持的平台:想要 {"os":"darwin","arch":"any"}(當前:{"os":"win32","arch": "x64"})

添加了來自 21 個貢獻者的 16 個包,刪除了 2 個包並在 92.167 秒內審核了 1949 個包

從技術上講,這不是一個答案,因為版本 12 應該以與版本 10 相同的方式工作。我將在下周進一步調查以提供真正的解決方案。

我對此問題的解決方法在更新 2 中有詳細說明,但基本上就是我在這里解釋的內容:我在此鏈接中看到過(錯誤: C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe失敗,退出代碼為:1)有些人嘗試在節點版本中降級,我最初使用的是版本 12,有人說版本 10 應該可以工作。 之后,我可以執行答案中提供的四個步驟:

對我來說,一旦我將 npm 更新到最新版本,這個問題就解決了

npm install npm@latest -g

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM