我正在进入Node.js代码库,这需要我通过NPM下载一些依赖项,即jQuery.
在尝试运行时npm install jquery,我不断收到此错误:
Your environment has been set up for using Node.js 0.8.21 (x64) and NPM
C:\Users\Matt Cashatt>npm install jquery
npm http GET https://registry.npmjs.org/jquery
npm http 304 https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/xmlhttprequest
npm http GET https://registry.npmjs.org/htmlparser/1.7.6
npm http GET https://registry.npmjs.org/location/0.0.1
npm http GET https://registry.npmjs.org/navigator
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/htmlparser/1.7.6
npm http 304 https://registry.npmjs.org/xmlhttprequest
npm http 304 https://registry.npmjs.org/location/0.0.1
npm http 304 https://registry.npmjs.org/navigator
npm http 304 https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/contextify
npm …Run Code Online (Sandbox Code Playgroud) 我尝试使用 npm 5.6.0 在 Windows 10 上安装模块。当我输入 npm install 时,我得到:
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\xiaooming\Desktop\app\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xiaooming\\Desktop\\app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\xiaooming\Desktop\app\node_modules\node-sass
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp …Run Code Online (Sandbox Code Playgroud) 我们在项目中运行"npm install"时遇到问题.无法找到某个文件:
fatal error C1083: Cannot open include file: 'windows.h'
Run Code Online (Sandbox Code Playgroud)
它似乎来自node-gyp模块:
c:\ Program Files \nodejs \node_modules \npm \node_modules \node-gyp\src\win_delay_lo ad_hook.c(13):
致命错误C1083:无法打开包含文件:'windows.h':没有文件或目录[D:\ngs-frontend-next \node_modules\browser-sync \node_module s\socket.io \node_modules\engine.io \node_modules\ws \node_modules\bufferutil\buil \\ binding.sln]
这个节点gyp似乎是我们痛苦的永无止境的源头.起初它抱怨它需要python,所以我们安装了它.然后它抱怨它需要VCBuild,我们安装(使用.NET 2.0 SDK),现在我们有这个错误.这几乎就像错误变得越来越模糊,感觉就像我们走错了道路一样.
奇怪的是,我们团队中的其他人在运行npm-install时没有任何问题.
完整错误如下所示:
c:\ Program Files \nodejs \node_modules \npm \node_modules \node-gyp\src\win_delay_lo ad_hook.c(13):
致命错误C1083:无法打开包含文件:'windows.h':没有文件或目录[D:\ngs-frontend-next \node_modules\browser-sync \node_module s\socket.io \node_modules\engine.io \node_modules\ws \node_modules\bufferutil\buil \\ binding.sln]
gyp ERR!构建错误gyp ERR!堆栈错误:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe退出代码失败:ChildProcess.onExit上的1个堆栈(C:\ Program Files \nodejs \node_modules \npm \node _modules \node-gyp\lib\build.js:270:23)gyp ERR!堆栈在emitTwo(events.js:87:13)gyp ERR!堆栈在ChildProcess.emit(events.js:172:7)gyp ERR!Process.ChildProcess._handle.onexit(internal/child_proces s.js:200:12)gyp ERR!系统Windows_NT 6.1.7601 gyp ERR!命令"C:\ Program Files \nodejs …
我遇到的问题是我无法安装项目的软件包,它一直出错:
npm ERR! npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! npm ERR! gyp ERR! find VS
npm ERR! npm ERR! gyp ERR! find VS **************************************************************
npm ERR! npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! …Run Code Online (Sandbox Code Playgroud) npm install node-sass --save-dev我正在尝试安装,windows 11但我得到了这个npm ERR! gyp ERR!
错误详情:
C:\Users\ABCD\source\repos\PageTitleTest\PageTitleTest>npm install node-sass --save-dev
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path C:\Users\ABCD\source\repos\PageTitleTest\PageTitleTest\node_modules\node-sass
npm ERR! command failed
npm ERR! …Run Code Online (Sandbox Code Playgroud) 我正在尝试filepreview使用npm. 但它总是给出错误。这是错误:
D:\Program Files\nodejs\PalettenzettelGenerator>npm install filepreview
> fibers@1.0.15 install D:\Program Files\nodejs\PalettenzettelGenerator\node_modules\synchronize\node_modules\fibers
> node build.js || nodejs build.js
D:\Program Files\nodejs\PalettenzettelGenerator\node_modules\synchronize\node_modules\fibers>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:415:16)
gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:63:19)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command …Run Code Online (Sandbox Code Playgroud)