Angular-cli failed to install properly

人盡茶涼 提交于 2021-02-10 05:01:51

问题


I wonder if you can help me.

I tried to install the angular-cli by the npm command

npm install -g angular-cli, however I got a lot of messages, and 'ng' command does not work.

Some of the errors I got are as following

> node-zopfli@1.4.0 install C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\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.5.0 (node-v48 ABI) (falling back to source compile with node-gyp) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\lib\configure.js:449:14) gyp ERR! stack at C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\lib\configure.js:404:11 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node" "--module_name=zopfli" "--module_path=C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli\lib\binding\node-v48-win32-x64" gyp ERR! cwd C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli gyp ERR! node -v v6.5.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\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node --module_name=zopfli --module_path=C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli\lib\binding\node-v48-win32-x64' (1) node-pre-gyp ERR! stack at ChildProcess. (C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\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\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli node-pre-gyp ERR! node -v v6.5.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\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-zopfli\lib\binding\node-v48-win32-x64\zopfli.node --module_name=zopfli --module_path=C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\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

node-sass@3.10.0 install C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-sass node scripts/install.js

Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.10.0/win32-x64-48_binding.node Binary downloaded and installed at C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-sass\vendor\win32-x64-48\binding.node

node-sass@3.10.0 postinstall C:\Users\my name\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-sass node scripts/build.js

Do I need to install anything other then node.js?

Im quite new to Angular, trying to do some tutorials and experiments

Thanks for your help and time


回答1:


I am not on Windows but what you should consider doing first, run command line with administrative privileges. select the application on secondary menu (right click) select runs as admin.

Before that make sure you have installed the latest version of node.js. and the run the following commands.

npm uninstall -g angular/cli npm cache clean npm install -g angular/cli@latest




回答2:


An update on this. I installed the new node.js V6.6.0, uninstalled the Angular-Cli, cleaned cache and re-installed the clie and it seems to have done the trick since I was able to install the Angular-CLI without problems this time, and ng new is working.




回答3:


set environment variable PYTHON, with value of full path where python.exe is installed. If its C:\Program Files\Python34\ then value will be C:\Program Files\Python34\python.exe



来源:https://stackoverflow.com/questions/39544204/angular-cli-failed-to-install-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!