npm 错误gyp ERR!堆栈错误:'C:\程序文件(x86)\MSBuild\14.0\bin\MSBuild.exe'失败,退出代码为:1在我的项目上安装节点时

qacovj5a  于 2022-11-14  发布在  其他
关注(0)|答案(2)|浏览(694)

我尝试在Spring项目的根文件夹中执行以下命令:npm安装本机@1.1.6
问题是,每次我执行命令时,无论我尝试什么,我都会得到一个错误(如下面的“错误本地人”所示)。

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 Boot 项目中执行这个命令,这样我就可以将Angular 模块与后端java模块进行通信。但遗憾的是,由于某些库的要求,我不能更改它。我在项目根文件夹中执行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它成功安装了依赖项
1.执行命令natives,并显示上面详述的错误:npm install natives@1.1.6这里我得到了我的错误。我一直在互联网上搜索,但我无法找到一个解决方案,帮助我。

我尝试修复以下问题:节点“C:\用户\用户1\应用程序数据\漫游\节点模块\节点模块\节点gyp\bin\节点gyp.js”重建

只有当我编辑binding.gpy文件时,这个方法才起作用,其中的内容在下面的链接中解释:https://github.com/nodejs/node-gyp/issues/119还binding.cc在src文件中添加了www.example.com文件,这有助于我执行rebuild命令。
我也尝试过按照这个解决方案,但它没有帮助我,因为我结束了所有是在上面写的相同的错误。x1c 0d1x我去了目录(C:\Users\USER1\AppData\Roaming\npm\node_modules\npm),并成功地执行了命令:Npm安装节点-gyp
之后,我执行:npm配置集msvs_版本2015 -全局
当我尝试执行下面的命令时,我得到了上面详述的相同错误:npm安装取消同步
我的实际配置是:

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

请不要将此问题标记为重复问题,因为这是一个基于在项目中部署节点依赖项的不同问题,使用特定版本,此问题未在前面的问题中涉及
我提供了我已经检查过但没有帮助我的流动链接:
Node-gyp. MSBuild.exefailed with exit code: 1](https://stackoverflow.com/questions/46225835/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.exefailed with exit code: 1](https://stackoverflow.com/questions/57814729/gyp-err-stack-error-c-program-files-x86-microsoft-visual-studio-2017-build) [Error:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exefailed with exit code: 1](https://stackoverflow.com/questions/54532854/error-c-program-files-x86-microsoft-visual-studio-2017-buildtools-msbuild-1) [gyp ERR! stack Error:C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exefailed with exit code: 1](https://stackoverflow.com/questions/32964144/gyp-err-stack-error-c-program-files-x86-msbuild-12-0-bin-msbuild-exe-fail/33119669)打印机 [gyp ERR! stack Error:C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe](https://stackoverflow.com/questions/52089305/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://stackoverflow.com/questions/52089305/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/2033) [https://github.com/nodejs/node-gyp/issues/1859](https://github.com/nodejs/node-gyp/issues/1859) [gulp - internalBinding is not defined](https://stackoverflow.com/questions/54433794/gulp-internalbinding-is-not-defined) 更新1我已经尝试做什么佩里钱微软告诉我,但我得到了同样的错误,我会尝试另一件事,我会让你知道结果。 UPDATE 2我做了一个暂时解决这个问题的方法,但我不知道这是否可以被认为是一个解决方案。我在这个链接([Error:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1)中看到,有些人试图在节点版本中降级,我最初使用的是版本12,有些人说版本10应该可以工作。之后,我可以执行答案中提供的四个步骤:
运行:npm缓存清除--强制

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)进行操作
第一件事是在windows中安装nvm,所以请转到以下链接(https://github.com/coreybutler/nvm-windows/releases)并下载nvm-setup.zip文件,解压缩并执行它,然后按照安装步骤进行安装。然后安装版本10,使用命令:nvm install 10.16.3之后,使用以下命令确保在您的计算机中启动的是哪个版本的nvm:nvm列表(在我的例子中返回了两个结果,其中版本12.18.3(当前使用...)和10.16.3。使用以下命令更改为版本10:nvm使用10.16.3
我已经按照步骤进行了操作,但是为了让npm install或npm install natives@1.1.6命令恢复工作,所以我再次执行了命令npm install natives@1.1.6,它工作了,并提供了一些跟踪信息:
npm警告不支持跳过可选相关性:不支持的fsevents@1.2.4平台:wanted {“os”:“达尔文”,“拱”:“任何”}(当前:(操作系统:win32,架构:x64)
在92.167s中添加了来自21个贡献者的16个软件包,删除了2个软件包并审核了1949个软件包
从技术上讲,这不是一个答案,因为版本12应该以与版本10相同的方式工作。我将在下周进一步调查,以便提供一个真实的的解决方案。

lnvxswe2

lnvxswe21#

我在更新2中详细介绍了这个问题,但它基本上是我在这里解释的:我在此链接中看到(错误:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe失败,退出代码:1)有人尝试在节点版本中进行降级,我原来使用的是版本12,有人说使用版本10应该可以。之后,我可以执行答案中提供的四个步骤:

9bfwbjaz

9bfwbjaz2#

对我来说,一旦我更新了npm到最新版本,这个问题就解决了

npm install npm@latest -g

相关问题