node.js - npm install 错误 - 一个 pre-gyp 错误

标签 node.js angular npm

我想安装 this使用 npm 的 Angular 2 日历。尝试使用 npm 安装它,然后下载并尝试安装它。在这两种情况下都失败了。

我在 Windows 上,之前在尝试安装 angular2 CLI 时遇到此错误。现在我收到这个包的相同错误,我不确定如何纠正它。我尝试卸载 CLI,然后清除缓存,但没有成功。

有人可以看看这个错误,让我知道我需要采取哪些步骤来纠正这个问题..

cmd 中出现的错误如下:

        C:\Users\simon\SPA\ANGULAR2 CALENDAR EXAMPLE>npm install

    > node-zopfli@1.4.0 install C:\Users\simon\node_modules\node-zopfli
    > node-pre-gyp install --fallback-to-build

    node-pre-gyp ERR! Tried to download: https://node-zopfli.s3.amazonaws.com/Release/zopfli-v1.4.0-node-v48-win32-x64.tar.gz
    node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@1.4.0 and node@6.6.0 (node-v48 ABI) (falling back to source compile with node-gyp)
    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\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error
     MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK vers
    ion in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\simon\
    node_modules\node-zopfli\build\zopfli.vcxproj]
    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:\Users\simon\node_modules\node-gyp\lib\build.js:276:23)
    gyp ERR! stack     at emitTwo (events.js:106:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    gyp ERR! System Windows_NT 10.0.14393
    gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\simon\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\simon\\node_modules\\node-zopfli\\lib\\binding\\node-v48-win32-x64\\zopfli.node" "--module_name=zopfli" "--module_path=C:\\Users\\simon\\node_modules\\node-zopfli\\lib\\binding\\node-v48-win32-x64"
    gyp ERR! cwd C:\Users\simon\node_modules\node-zopfli
    gyp ERR! node -v v6.6.0
    gyp ERR! node-gyp -v v3.4.0
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\simon\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node --module_name=zopfli --module_path=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\simon\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
    node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
    node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
    node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
    node-pre-gyp ERR! System Windows_NT 10.0.14393
    node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\simon\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd C:\Users\simon\node_modules\node-zopfli
    node-pre-gyp ERR! node -v v6.6.0
    node-pre-gyp ERR! node-pre-gyp -v v0.6.30
    node-pre-gyp ERR! not ok
    Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\simon\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node --module_name=zopfli --module_path=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64' (1)

我在 node.js 6.6.0 和 npm 3.10.3

编辑:

我希望 Luiz 回答...

npm install -g node-gyp

会工作,但不幸的是,安装对健身房来说非常完美。我遇到了这些错误......如下......

    > node-zopfli@1.4.0 install C:\Users\simon\node_modules\node-zopfli
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://node-zopfli.s3.amazonaws.com/Release/zopfli-v1.4.0-node-v48-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@1.4.0 and node@6.6.0 (node-v48 ABI) (falling back to source compile with node-gyp)
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\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and select
ing "Retarget solution". [C:\Users\simon\node_modules\node-zopfli\build\zopfli.vcxproj]
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:\Users\simon\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\simon\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\simon\\node_modules\\node-zopfli\\lib\\binding\\node-v48-win32-x64\\zopfli.node" "--module_name=zopfli" "--module_path=C:\\Users\\simon\\node_modules\\node-zopfli\\lib\\binding\\node-v48-win32-x64"
gyp ERR! cwd C:\Users\simon\node_modules\node-zopfli
gyp ERR! node -v v6.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\simon\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node --module_name=zopfli --module_path=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\simon\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.14393
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\simon\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\simon\node_modules\node-zopfli
node-pre-gyp ERR! node -v v6.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.30
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\simon\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node --module_name=zopfli --module_path=C:\Users\simon\node_modules\node-zopfli\lib\binding\node-v48-win32-x64' (1)
npm WARN install:node-zopfli@1.4.0 node-zopfli@1.4.0 install: `node-pre-gyp install --fallback-to-build`
npm WARN install:node-zopfli@1.4.0 Exit status 1
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\simon\package.json'
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-alpha.6 requires a peer of @angular/forms@^2.0.0 but none was installed.
npm WARN string-replace-loader@1.0.4 requires a peer of webpack@1.x.x || 2.x.x || 2.x.x-beta but none was installed.
npm WARN simon No description
npm WARN simon No repository field.
npm WARN simon No README data
npm WARN simon No license field.

似乎有更多问题..还有更多想法

最佳答案

我在 Windows 上遇到了类似的问题,全局安装 node-gyp 消除了这些错误。

# before installing node-gyp on windows
npm install --global --production windows-build-tools

# install node-gyp globally
npm install -g node-gyp

关于node.js - npm install 错误 - 一个 pre-gyp 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39674390/

相关文章:

javascript - 如何在请求调用时将值传递给回调函数?

node.js - 如何在node js中进行同步

Angular PUT 请求在 SSL 上被禁止

angularjs - npm install -g karma 错误 MSB4019 : The imported project "C:\Microsoft.Cpp.Default.props" was not found

node.js - Docker ENTRYPOINT/CMD 找不到文件

javascript - 如何使用 Nodejs 抓取 QlikView 表?

events - NodeJS 等待回调在事件发出时完成

angular - Ionic-3 如何动态改变 ionic 主题

angular - 由于错误 : Error: Module build failed: Error: ENOENT: no such file or directory, 打开,预呈现失败

node.js - 让 Cordova/Phonegap 在 Genymotion 虚拟设备上进行仿真