[英]Node-gyp. MSBuild.exe` failed with exit code: 1
I was trying to install sharp module, which requires: c++ compiler - I downloaded Visual Studio 2017 and visual c++ build tools node-gyp - It was installed successfully我正在尝试安装 sharp 模块,它需要:c++ 编译器 - 我下载了 Visual Studio 2017 和 visual c++ 构建工具 node-gyp - 安装成功
But running 'npm install -g sharp' I got many errors但是运行'npm install -g sharp'我遇到了很多错误
E:\VS\MSBuild\15.0\Bin\MSBuild.exe
failed with exit code: 1 gyp ERR:堆栈错误: E:\VS\MSBuild\15.0\Bin\MSBuild.exe
失败,退出代码:1node-gyp rebuild
npm ERR! errno 1 npm ERR: sharp@0.18.3 install: node-gyp rebuild
npm ERR! Exit status 1退出状态 1If it matters - I'm a Windows user如果重要 - 我是 Windows 用户
It sounds like build tools are not installed, You have to install the build tools for Windows听起来好像没有安装构建工具,你必须安装 Windows 的构建工具
npm install --global windows-build-tools
Just came across a similar problem and after a lot of searches online, it seems like a problem with the latest node version that automatically integrate and use v8 engine, that older dependencies doesn't support.刚刚遇到一个类似的问题,在网上搜索了很多次之后,似乎是最新的节点版本自动集成和使用v8引擎的问题,旧的依赖项不支持。 it seems like an ms-build problem, but that's probably not the real issue.这似乎是一个 ms-build 问题,但这可能不是真正的问题。 I have tried the following without success:我尝试了以下但没有成功:
%APPDATA%\\npm-cache\\_libvips
and installing from here删除%APPDATA%\\npm-cache\\_libvips
并从这里安装npm install --global windows-build-tool
运行npm install --global windows-build-tool
This is how I solved it:我是这样解决的:
npm install npm@latest -g
通过运行npm install npm@latest -g
更新到最新版本npm install --ignore-scripts
导航到您的项目文件夹(之前安装失败的位置)并运行npm install --ignore-scripts
node-sass
you'd might want to also run this: npm rebuild node-sass --force --ignore-scripts
(附带说明),如果它与node-sass
一起使用,你可能还想运行这个: npm rebuild node-sass --force --ignore-scripts
When you install the vs_BuildTools.exe by using this command使用此命令安装 vs_BuildTools.exe 时
npm install --global windows-build-tools npm 安装 --global windows-build-tools
if you encounter some errors, try installing manually.如果遇到一些错误,请尝试手动安装。
Then don't forget to add the msbuild.exe to your system path.然后不要忘记将 msbuild.exe 添加到您的系统路径。
ie C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64即 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64
when this is not in your path, the system tries to use another msbuild.exe from your .NET installation.当它不在您的路径中时,系统会尝试使用您的 .NET 安装中的另一个 msbuild.exe。
I fixed mine like that.我就这样修好了我的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.