2016-09-24 65 views
3

我想安裝this使用npm的角度2日曆。試圖使用npm來安裝它,然後下載它並嘗試安裝它。在兩種情況下都失敗了。錯誤與npm安裝 - 一個pre-gyp錯誤

我在Windows和我以前得到這個錯誤試圖安裝angular2 CLI。現在我得到這個包的錯誤,我不知道如何糾正它。我試圖取消啓動CLI,然後清除緩存,並沒有奏效。

能有一個人看看錯誤,讓我知道什麼步驟我需要做什麼來糾正這種..

的錯誤,因爲它出現在CMD如下:

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

    > [email protected] 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 [email protected] and [email protected] (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

編輯:

我希望路易斯答案...

npm install -g node-gyp 

的工作,但不幸的是,惠斯特的安裝非常完美的健身房。我得到了這些錯誤..如下...

> [email protected] 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 [email protected] and [email protected] (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:[email protected] [email protected] install: `node-pre-gyp install --fallback-to-build` 
npm WARN install:[email protected] Exit status 1 
npm WARN optional Skipping failed optional dependency /chokidar/fsevents: 
npm WARN notsup Not compatible with your operating system or architecture: [email protected] 
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\simon\package.json' 
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/[email protected]^2.0.0 but none was installed. 
npm WARN [email protected] requires a peer of [email protected] || 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. 

似乎有更多的問題..任何更多的想法

+0

嘿我更新了我的答案。我忘了提到安裝[node-gyp]之前的一個步驟(https://github.com/nodejs/node-gyp)。 – Luiz

回答

5

我在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 
+0

我得到了另一個項目,我想安裝,並在那一個我得到了失敗的fsevents依賴關係「npm WARN可選跳過失敗可選依賴項/ chokidar/fsevents:」但Windows工具安裝(我已經注意到,python 2.7是一個新的安裝在我的系統上)和node-gyp一樣,最後我創建了node_modules文件夾,並且能夠運行該應用程序。我仍然無法安裝cli,但是爲Luiz增加了+1 – si2030

0

我不得不安裝python第一個python.org,因爲node-gyp不支持更高版本,所以需要使用2.7版本。

所以安裝python 2.7,然後npm install -g node-gyp。這對我有用,並擺脫了所有其他錯誤安裝angular-cli以及。