7

I Am new in Angular2 Cli, Here I found an errors while running my Cli project.

ERROR in multi main, Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:4200/' in 'node_modules\angular-cli\ models'

I have installed 'webpack' and 'webpack-dev-server' globally, but still the error remain.

Any body, please help me to find a solution.

Thanks,

vipin
  • 357
  • 3
  • 9

4 Answers4

1

You don't need to install webpack nor webpack-dev-server globally. They come installed by CLI.

I had the same issue today. And I discovered that I was using an old shell session that was using Node v4. After upgrading to a newer version of Node (v6). I had no more issue.

Wassim Chegham
  • 550
  • 4
  • 15
  • I was using Nodev4.4.7 – vipin Oct 28 '16 at 13:25
  • can you upgrade to v6? – Wassim Chegham Oct 28 '16 at 14:02
  • Yah wassim I have upgrade that to latest, 6.9.1, but throws some error while I creating new project. – vipin Oct 31 '16 at 06:26
  • I'm still having this problem I tried with node7 and node6 but still the same error, has anyone find a solution yet? – Yahya KACEM Nov 02 '16 at 20:29
  • I think its a version problem, I got a new error [ Cannot find module 'broccoli-funnel'] while creating new project. – vipin Nov 03 '16 at 11:05
  • I tried node v7.0.0, v6.9.1 and 6.9.0, also angular-cli-1.0.0-beta.18 and angular-cli-1.0.0-beta.19-3 and npm 3.10.9 and npm4.0.1 but still the same error. – Yahya KACEM Nov 03 '16 at 12:44
  • My problem was that I have set npm to install the packages in a legacy bundling way by adding this line to /home/user/.npmrc file: legacy-bundling=true, removing that file and reinstalling everything solved my problem. – Yahya KACEM Nov 03 '16 at 15:05
1

Upgrade your node

https://nodejs.org/en/

Install

npm cache clean

npm update -g

npm install -g ember-cli

Then delete your old project and run commands again

npm install -g angular-cli

ng new my-new-app

cd my-new-app

ng serve
vaquar khan
  • 10,864
  • 5
  • 72
  • 96
0

I am having the same error.

node 6.9.0, npm 3.10.8

EDIT:

Solved my problem via this issue.

The solution was to install angular-cli locally.

0

In my case, it was failing not only for webpack-dev-server but also couldn't find the application module and app.component.sccs (some info about that here).

I've tried a lot of options, like the official Angular setup guide and ofc the above solutions.

It turned out the issue was a damn simple which ordinary can happen when developing for Windows, which was that the application path was too long. By moving the project to the drive root folder, all problems were gone.

Arsen Khachaturyan
  • 7,904
  • 4
  • 42
  • 42