angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular-cli just does not work on Windows/Visual Studio, period.

Open tx8821 opened this issue 10 years ago • 31 comments

You guys don't ever test anything on Windows/Visual Studio probably, otherwise I just can't understand how you can work with something broken this much. Just trying to setup hello-world project with angular-cli for half a day now but can't get to the working NG command.

Here is my setup: Windows 10; Visual Studio 2015.3; Node v5.4.1; NPM v3.10.7; Python 2.7; All clean install, clean system without errors.

Here are my steps:

npm install -g https://github.com/angular/angular-cli.git

As I want to get the latest version (that plays with RC6), I have to install directly from github.

First comes the bunch of errors about missing peer dependencies! The readme says that you have to just install "npm install -g angular-cli" and that's all. Well, after above command, there are bunch of unmet peer dependency warnings, which you have to install one after another, some of them requiring conflicting versions (typescript 1.8, 1.9 and 2.0 were all requested by different "peers").

To install peer dependencies, I run:

npm install -g zone.js [email protected] tslint @angular/platform-server @angular/core @angular/common @angular/compiler @angular/platform-browser webpack@^2.1.0-beta.22

Many errors go away, but there are still some peer dependencies that just can't be cured. When I run "npm list -g --depth=0" I get these:

npm ERR! peer dep missing: [email protected], required by @angular/[email protected] npm ERR! peer dep missing: typescript@^1.9.0-dev, required by @angular/[email protected] npm ERR! peer dep missing: [email protected] || 2.x.x, required by [email protected] npm ERR! peer dep missing: typescript@^1.8.0 || ^1.9.0-dev, required by [email protected]

Even though I explicitly (and successfully) installed [email protected] and webpack@^2.1.0-beta.22, and that very same versions are listed by "npm list -g", it still reports the "peer dep missing" on them.

Ok, maybe this is the way it should be - I think, maybe the angular-cli will work regardless... NOPE.

when I run anything with NG (like ng help), it gives an error:

Error while running script "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\angular-cli\addon\ng2\models\webpack-build-common.ts": Error: Cannot find module '@angular-cli/base-href-webpack' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\angular-cli\addon\ng2\models\webpack-build-common.ts:7:27) at Module._compile (module.js:397:26) at Object.require.extensions..ts (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\angular-cli\lib\bootstrap-local.js:30:14) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) ....... AND SO ON

This thing just does not work with Windows / Visual Studio. You should have written this in your readme with BIG RED TEXT. I appreciate the work that you are doing, I'm very grateful for what you've built and I really think that Angular 2 is a fascinating platform really, but... I've wasted DAYS to understand all these systemjs/webpack/angular-cli/whatever ways of building Angular 2 project, just to get to the hello-world example, but 9 out of 10 instructions that are given in docs simply don't work out of the box. I'm not even mentioning bunch of intermediate errors and workarounds that I had to overcome just to get to that point.

Is it really hard, to put down a simple, step-by-step instructions for angular-cli, on Windows/Visual Studio (clean install!) for example?.... What's the point with all your unit testing, integration testing, wudu dancing, if even the hello-world project can't be built on a clean system, even after following all those 2999 steps?

tx8821 avatar Sep 12 '16 02:09 tx8821

@DeWitt-A You say some warnings on test, but did you look in the browser console? Open the console and reload the page and you'll see an error showing that Karma isn't running in the browser. I've got another issue open on that (with no comments or response)

jtsom avatar Sep 14 '16 23:09 jtsom

@tx8821 I'd like to start off by saying that I do all of my development of the CLI in a Windows 10 machine, with both node4 and 5, npm 3 and Visual Studio Code. I don't know much about your troubles with Visual Studio (non code) but if it works from the CLI and with other editors, I take it whatever problem you have in VS is related to VS.

I just globally installed angular-cli a couple of times from scratch, and test commands, as I do every other day. I often do this on brand new node install to be sure everything is fine. I also don't have python or anything else installed, I just use npm and node because I assume that's what users have.

For some reason you decided to do npm install -g https://github.com/angular/angular-cli.git. Not sure where you got that idea from since it's not on the readme or anything, but that doesn't work. It doesn't work for a whole lot of packages on npm because when you publish something on npm it is not necessarily what's on your repo. It's very common to have a build step, such as we have introduced recently, which creates necessary assets (commonly dist/).

If you want to work with the latest master, check the instructions in https://github.com/angular/angular-cli#development-hints-for-hacking-on-angular-cli. This is what the team uses to work with the repo and have the latest version.

There have been two issues affecting installs though, both npm:

  • https://github.com/npm/npm/issues/13782 (npm hanging)
  • https://github.com/npm/npm/issues/10343 (npm link stealing packages, fixed in https://github.com/angular/angular-cli/pull/2086)

I'm sorry you had a bad experience, but it seems to have been rooted in you doing npm install -g https://github.com/angular/angular-cli.git instead of npm install -g angular-cli@webpack.

filipesilva avatar Sep 15 '16 00:09 filipesilva

Every time I try to do a npm install -g angular-cli or npm install -g angular-cli@webpack, this is the warning I'm getting: npm WARN [email protected] requires a peer of [email protected] || 2.x.x but none was installed. I tried manually installing webpack, but still the same.

Worst part is that doing a npm list -g --depth=0 throws out an error like so after doing the angular-cli install above.:

C:\Users\Rajshri Mohan K S\AppData\Roaming\npm
+--  error: ENOENT: no such file or directory, open 'C:\Users\Rajshri Mohan K S\AppData\Roaming\npm\node_modules\angular-cli\package.json
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

The error goes away after I do npm uninstall -g angular-cli.

I appreciate the work you are doing. I just want to bring this to your notice.

rajshrimohanks avatar Sep 16 '16 16:09 rajshrimohanks

npm i -g [email protected] was the only way to get it work again.

This saved me! But seriously, this is ridiculously complex to install. How would one even know to use that given the "simple" instruction provided on the main cli page?

PaybackMan avatar Sep 17 '16 18:09 PaybackMan

I installed the "ng new migration-project" and then did ng serve. It worked perfectly on VS Code/Windows 10/ Angular final. However, when I add in my src code (angular final -- all works fine with angular cli beta10) after I installed beta14 cli and build, I get these errors:

ERROR in [default] E:\development\ketogeniqweb\node_modules@angular\platform-browser\src\facade\collection.d.ts:102:21 Cannot find name 'Set'.

ERROR in [default] E:\development\ketogeniqweb\node_modules@angular\platform-browser\src\facade\collection.d.ts:103:24 Cannot find name 'Set'.

ERROR in [default] E:\development\ketogeniqweb\node_modules@angular\router\src\config.d.ts:279:61 Cannot find name 'Promise'.

ERROR in [default] E:\development\ketogeniqweb\src\app\app.component.ts:16:13 Cannot find name 'require'.

ERROR in [default] E:\development\ketogeniqweb\src\app\classes\calculator.ts:50:61 Property 'log10' does not exist on type 'Math'.

I'm thinking it has to do with typings, but I installed the @typings for all the packages I could. Any ideas on how to make this build?

Xamlware avatar Sep 17 '16 18:09 Xamlware

@rajshrimohanks @PaybackMan @Xamlware this issue is closed, please make new issues instead of replying here.

filipesilva avatar Sep 20 '16 02:09 filipesilva

I understand this issue is closed but im posting a solution for posterity's sake.

I followed all the solutions posted here except ones that required installing specific versions of the CLI as noted by @PaybackMan and using VS Code instead of Atom.

What worked for me is running npm start instead of ng serve from the project root

rodneystrong avatar Oct 03 '16 17:10 rodneystrong

This stuff isn't ASP.Net/Windows specific. I'm facing exactly the same issues using linux. Currently mid way into a greenfield project and really wishing I had stuck with Angular 1 or React.

fergalmoran avatar Oct 27 '16 22:10 fergalmoran

@fergalmoran -- I'd like to help -- as @filipesilva noted above, this issue is close, so please open a new issue with all the details of the issue you're facing. FWIW, I'm using Angular 2 on Linux with Angular CLI and Angular Material and it's working well, despite various issues in each of these rapidly maturing libraries...

JanStureNielsen avatar Oct 27 '16 23:10 JanStureNielsen

The correct answer is to use the command line option below when ever you do a npm install! --no-optional

Sydwell avatar Nov 07 '17 06:11 Sydwell

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.