简体   繁体   English

windows 寻找工具版本上的节点 npm 错误

[英]Node npm error on windows looking for tools version

Im trying to use node and when i go to install the npm packages via 'npm install package.json'我正在尝试使用节点,当我 go 通过“npm install package.json”安装 npm 包时
I am currently using windows 8.1 as my os.我目前使用 windows 8.1 作为我的操作系统。 It began when I started using redis but im not sure if it is because of redis. The error I get is它开始于我开始使用 redis 但我不确定是不是因为 redis。我得到的错误是

MSBUILD: error MSB4132: The tools version "2.0" is unrecognized. MSBUILD:错误 MSB4132:无法识别工具版本“2.0”。 Available tools versions are "4.0".可用的工具版本为“4.0”。

The full console print out is here完整的控制台打印输出在这里

If anyone has come across this error and how to fix it would be greatly appreciated如果有人遇到此错误以及如何解决它,将不胜感激

Provided that you have Nodejs installed, start Windows CMD in admin mode and run the following:如果您安装了 Nodejs,请以管理员模式启动 Windows CMD 并运行以下命令:

npm install --global --production windows-build-tools

and restart your PC afterwards.然后重启你的电脑。

安装 Visual Studio 或 Visual Studio Express 2013。您可以在此处下载它们:http ://www.visualstudio.com/downloads/download-visual-studio-vs

Since most of the answers here are from 2015, thought I provide a fresh guide.由于这里的大部分答案来自 2015 年,我想我提供了一个新的指南。

MS build tools can be installed without installing Visual studio.无需安装 Visual Studio 即可安装 MS 构建工具。 The link below [Check step 3] shows how to install "Visual Studio Installer". [检查步骤 3] 下面的链接显示了如何安装“Visual Studio 安装程序”。 You can use it to install the required MS build tools.您可以使用它来安装所需的 MS 构建工具。

https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio#step-3--- https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio#step-3---

Following is a screenshot of the workloads I installed以下是我安装的工作负载的屏幕截图

在此处输入图片说明

PS: You might need to restart your machine PS:您可能需要重新启动机器

最后,微软提供了更好的解决方案来构建原生 Node.js 包。

As of current you can grab Visual Studio 2013 Community Edition.截至目前,您可以获取 Visual Studio 2013 社区版。 http://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx http://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx

在此处输入图片说明

These commands worked for me.这些命令对我有用。

 & npm --add-python-to-path='true' --debug install --global windows-build-tools
 & npm config set python "%USERPROFILE%\.windows-build-tools\python27\python.exe"
 & npm install -g windows-build-tools
 & npm install.
 & npm start.

Solution found here解决方案在这里找到

Installing MS Build Tool 2013 Solved my problem.安装 MS Build Tool 2013 解决了我的问题。

https://www.microsoft.com/en-us/download/details.aspx?id=40760 https://www.microsoft.com/en-us/download/details.aspx?id=40760

Open up a new cmd as administrator and run this command:以管理员身份打开一个新的 cmd 并运行以下命令:

npm install --global --production windows-build-tools

then然后

npm config set msvs_version 2015 --global

close all instances of shell/cmd, reopen a cmd (regular this time, non-administrator) return to your directory where you are trying to run npm install and run it again关闭所有 shell/cmd 实例,重新打开一个 cmd(这次是常规,非管理员)返回到您尝试运行 npm install 的目录并再次运行它

NOTE:笔记:

If you're seeing this in 2019, you may need如果你在 2019 年看到这个,你可能需要

npm config set msvs_version 2017

Please run the below command to fix this issue MSBUILD: error MSB4132: The tools version "2.0" is unrecognized.请运行以下命令修复此问题 MSBUILD:错误 MSB4132:无法识别工具版本“2.0”。 Available tools versions are "4.0".可用的工具版本是“4.0”。

=> open git bash or CMD after go to project path 
=> npm --add-python-to-path='true' --debug install --global windows-build-tools
=> npm config set python "%USERPROFILE%\.windows-build-tools\python27\python.exe"
=> npm install -g windows-build-tools
=> npm run dev
  1. Install all you need Node.js, VSCode, Python 2.7, etc.安装所有你需要的 Node.js、VSCode、Python 2.7 等。
  2. Run as admin VSCode.以管理员身份运行 VSCode。
  3. In VSCode bash write npm install --global windows-build-tools --vs2015在 VSCode bash 中写入npm install --global windows-build-tools --vs2015
  4. npm install

Works on Windows 11.在 Windows 11 工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 节点Windows NPM未安装 - Node Windows NPM not installing npm无法构建socket.io,错误“与您的节点版本不兼容/ npm:commander@0.5.0” - npm fails to build socket.io with Error “Not compatible with your version of node/npm: commander@0.5.0” 安装node.js v6.11.2不会在Windows 7上安装正确的npm版本 - Installing node.js v6.11.2 does not install proper npm version on windows 7 节点JS NPM错误 - Node JS NPM Error 如何通过查看代码仓库确定节点版本 - how determine node version by looking at code repo 安装节点版本高于当前系统节点版本的 NPM 包时,如何抛出“在包中找到较低的节点版本”错误? - How to throw "Lower Node Version Found in Package" error when installing NPM package having node version higher than current system node version? 错误:节点 Sass 版本 5.0.0 与 ^4.0.0 不兼容(使用此命令后:“npm install node-sass@4.14.1”仍然抛出相同的错误 - Error: Node Sass version 5.0.0 is incompatible with ^4.0.0 (After using this command : “npm install node-sass@4.14.1” still throws a same error 安装节点6后,npm ERR出错! 无效的版本:1.0.5beta - Error after installing Node 6, npm ERR! Invalid Version: 1.0.5beta 尝试修复不同节点模块版本错误时,npm 重建不起作用 - npm rebuild doesn't work when trying to fix different node module version error 最新版本的npm(和节点)的未满足依赖性 - Unmet dependencies for the last version of npm (and node)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM