每次我尝试npm install。我收到以下错误。我如何解决它?
gyp: No Xcode or CLT version detected!
Run Code Online (Sandbox Code Playgroud)
我在node -v ? v8.8.0&npm -v ? v6.11.3
我尝试在 VSCode 终端和 iTerm 上运行它,但最终都出现了相同的错误。(两者都更新到最新版本)。我所做的唯一新事情是将我的 macOS 更新到最新版本(今天是 Catalina 10.15.3)。
$ npm install Fri Mar 6 17:22:40 2020
> fsevents@1.2.11 install /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/node_modules/fsevents
> node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack …Run Code Online (Sandbox Code Playgroud) 我无法安装任何需要编译的模块.所有这些都失败了,出现以下错误:
MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". ...
Run Code Online (Sandbox Code Playgroud)
我的环境:
相关环境变量:
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShel l\v1.0;C:\Program Files\TortoiseGit\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\tools;c:\tools\node
Run Code Online (Sandbox Code Playgroud)
没有INCLUDE,LIB,LIBPATH等
我对该问题进行了简短的调查,并通过以下设置确定手动编译(直接调用VCBuild.exe和msbuild.exe)成功进行手动克隆的git://github.com/einaros/ws.git:
SET Configuration=Release
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcpackages
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\bin;%PATH%
SET PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE;%PATH%
SET PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
SET PATH=%SystemRoot%\system32;%PATH%
SET INCLUDE=%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\include
SET INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE% …Run Code Online (Sandbox Code Playgroud) 任何人都可以解释我是什么node-gyp以及为什么它使用我的系统文件来构建Node.JS包.
node-gyp内部使用它.这种方法会起作用吗?
我想在Windows 10机器上使用visual studio community 2015安装bcrypt,安装Python v2.7.3但是我收到以下错误.
节点版本v4.2.1 node-gyp v3.0.3
npm install bcrypt
C:\Users\ASMIN\Desktop\M2\app>npm install bcrypt
npm WARN package.json eapp@1.0.0 No description
npm WARN package.json eapp@1.0.0 No repository field.
npm WARN package.json eapp@1.0.0 No README data
> bcrypt@0.8.5 install C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt
> node-gyp rebuild
C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node
-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: …Run Code Online (Sandbox Code Playgroud) 我已经花了整整一周的时间寻找这个问题的答案,但没有成功。我查看了所有 StackOverflow 帖子、Google 的每一篇文章以及我能找到的每个相关的 Github 问题。大多数相关错误似乎都比较旧,所以我想知道我的问题是否由于我使用的是 macOS Big Sur 而略有不同。
\n问题: \n当我尝试yarn install在本地存储库中运行时,收到与 node-gyp 相关的错误以及无法找到的 python 可执行文件。这是我的终端显示的内容:
yarn install v1.22.17\n\n...other stuff\n\n[4/4] Building fresh packages...\n[6/13] \xe2\xa0\x90 node-sass\n[2/13] \xe2\xa0\x90 node-sass\n[10/13] \xe2\xa0\x90 metrohash\n[4/13] \xe2\xa0\x90 fsevents\nerror /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments:\nDirectory: /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash\nOutput:\ngyp info it worked if it ends with ok\ngyp info using node-gyp@3.8.0\ngyp info using node@12.18.0 | darwin | x64\ngyp ERR! configure error\ngyp ERR! stack Error: Can\'t find Python executable "/usr/local/opt/python@3.9/bin/python3", you can set the PYTHON env variable.\ngyp …Run Code Online (Sandbox Code Playgroud) 运行时出现如下错误yarn install
gyp/bin/node-gyp.js clean configure
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.1
gyp info using node@16.18.1 | darwin | arm64
gyp info find Python using Python version 3.11.0 found at \"/Library/Frameworks/Python.framework/Versions/3.11/bin/python3\"
(node:28367) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/username/chegg-web/node_modules/node-gyp/gyp/gyp_main.py',
gyp info …Run Code Online (Sandbox Code Playgroud) 这是我到目前为止在x64操作系统上所做的事情:
成功执行了node-gyp configure(来自我在node.spp所在的nodejs \node_modules下的附加目录)
运行node-gyp build(作为管理员)**这是崩溃的原因,让我:
这个错误:
C:\Program Files\nodejs\node_modules\msnodesql>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.25 | win32 | x64
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. …Run Code Online (Sandbox Code Playgroud) 有没有办法在npm package.json文件中指定操作系统特定的依赖项?
例如,如果用户运行Linux ,我只想安装'dbus'(https://npmjs.org/package/dbus)作为我模块的依赖项.我对Mac和Windows有不同的依赖.
用Windows 10重新安装我的机器后,Visual Studio 2015我在安装我的git存储库时遇到了这个错误:
→ npm install在以下不同项目中失败:
...
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: "__pfnDliNotifyHook2": [...]
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\...\node_modules\buffertools
gyp ERR! node -v v4.4.7 …Run Code Online (Sandbox Code Playgroud) 我有一个使用bufferutils和的NPM项目utf-8-validate,都需要node-gyp来安装它们.当我这样做时npm install,我得到以下错误:
> bufferutil@1.2.1 install C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil
> node-gyp rebuild
C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil {git}{hg}
{lamb} if not defined npm_config_node_gyp (node "C:\Users\Marek\AppData\Roaming\npm\node_modules\npm\bin\node-g
yp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
bufferutil.cc
C:\Users\Marek\.node-gyp\5.1.1\include\node\v8.h(18): fatal error C1083: Cannot open include file: 'stddef.h':
No such file or directory [C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil\build\bufferutil.vcx
proj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed …Run Code Online (Sandbox Code Playgroud)