问题
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
But running 'npm install -g sharp' I got many errors
- gyp ERR! stack Error:
E:\VS\MSBuild\15.0\Bin\MSBuild.exe
failed with exit code: 1 - gyp ERR! stack at ChildProcess.onExit (C:\Users\MyUsername\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\li \build.js:258:23)
- gyp ERR! stack at emitTwo (events.js:125:13)
- gyp ERR! stack at ChildProcess.emit (events.js:213:7)
- gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
- gyp ERR! System Windows_NT 10.0.15063
- gyp ERR! command "C:\Program Files\nodejs\node.exe"
- "C:\Users\MyUsername\AppData\Roaming\npm\node_modules\npm\nod _modules\node-gyp\bin\node-gyp.js" "rebuild"
- gyp ERR! cwd C:\Users\MyUsername\AppData\Roaming\npm\node_modules\sharp
- gyp ERR! node -v v8.5.0
- gyp ERR! node-gyp -v v3.6.2
- gyp ERR! not ok
- npm WARN Error: EPERM: operation not permitted, unlink
- 'C:\Users\MyUsername\AppData\Roaming\npm\node_modules\sharp\node_modu es\color-name\package.json'
- npm WARN { Error: EPERM: operation not permitted, unlink 'C:\Users\MyUsername\AppData\Roaming\npm\node_modules\sharp\node_m dules\color-name\package.json'
- npm WARN stack: 'Error: EPERM: operation not permitted, unlink \'C:\Users\MyUsername\AppData\Roaming\npm\node_module \sharp\node_modules\color-name\package.json\'',
- npm WARN errno: -4048,
- npm WARN code: 'EPERM',
- npm WARN syscall: 'unlink',
- npm WARN path:
- 'C:\Users\MyUsername\AppData\Roaming\npm\node_modules\sharp\node_modules\color-name\package.json' }
- npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sharp@0.18.3
install:
node-gyp rebuild
npm ERR! Exit status 1
If it matters - I'm a Windows user
回答1:
It sounds like build tools are not installed, You have to install the build tools for Windows
npm install --global windows-build-tool
more details
来源:https://stackoverflow.com/questions/46225835/node-gyp-msbuild-exe-failed-with-exit-code-1