3

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

JMon
  • 3,387
  • 16
  • 63
  • 102

3 Answers3

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

Robert
  • 2,342
  • 2
  • 24
  • 41
G B
  • 2,323
  • 3
  • 18
  • 32
  • I tried that but I am still getting the same errors. It does install an angular-cli in my Roaming/npm/node_modules but when I try ng --help, its telling me that 'ng' is not recognized as an internal or external command, – JMon Sep 17 '16 at 08:19
  • I was thinking of running Linux on Hyper-V, do you think its worth the hassle? Would it run smoother maybe? – JMon Sep 17 '16 at 08:37
  • installed a VM and angular cli running there now. – JMon Sep 17 '16 at 17:24
  • For your first question you can fix it as explained here. http://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command – G B Sep 18 '16 at 08:40
  • It would run better but with windows you just need to set up everything right. But if you move to linux the better. – G B Sep 18 '16 at 08:42
  • already tried that, did not work. Installation of cli is not working, not a PATH issue – JMon Sep 20 '16 at 06:43
  • i will try again in a couple of days, yes working in windows would be easier and faster – JMon Sep 20 '16 at 06:45
  • It is because angular/cli is not installed properly in your machine – Alekya Aug 23 '18 at 10:05
1

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

Ali Hesari
  • 1,821
  • 5
  • 25
  • 51
has0511
  • 11
  • 2
0

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.

JMon
  • 3,387
  • 16
  • 63
  • 102