Angular-cli: ng serve giving errors

Created on 28 Oct 2016  路  8Comments  路  Source: angular/angular-cli

Hi,

ng serve is always giving these errors

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

ERROR in [default] /Users/z001mss/bnsf/src/app/app.component.ts:5:12
Cannot find name 'require'.

ERROR in [default] /Users/z001mss/bnsf/src/app/app.component.ts:6:11
Cannot find name 'require'.

going to localhost:4200, just says loading

Please provide us with the following information:

OS?

Mac OSX (Yosemite)

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.18
node: 7.0.0
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
none

The log given by the failure.

Normally this include a stack trace and some more information.
ERROR in multi main
Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:4200/' in '/usr/local/lib/node_modules/angular-cli/models'
@ multi main

ERROR in [default] /Users/z001mss/bnsf/src/app/app.component.ts:5:12
Cannot find name 'require'.

ERROR in [default] /Users/z001mss/bnsf/src/app/app.component.ts:6:11
Cannot find name 'require'.

Most helpful comment

npm install webpack && npm install webpack-dev-server resolved the problem for me.

All 8 comments

try: npm install webpack && npm install webpack-dev-server

@rahulbats can you try nuking node_modules, clearing the npm cache, and installing the latest version of the cli and see if the issue persists?

npm install webpack && npm install webpack-dev-server resolved the problem for me.

The only thing you should need to do is npm install @types/node. It should be included in the latest package.json of generated projects, but if you've been updating your project from older versions it might not be there.

Hi,

I've got the same error:
ERROR in multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

In my case the solution was deleting the spaces/special characters fom the folder's name:
"d:! Oszkar !\Prog\angular-test\"

After changing it was fine:
"d:\Oz\Prog\teszt-zzz\"

I hope it helps if you have the same problem... :)

hi,
@OszkarOlah 's solution helps me.
Thanks.

npm install -g @angular/cli
ng new my-dream-app
cd my-dream-app
ng serve

NOT WORKING

_An unhandled exception occurred: argument fn must be a function
See "C:\Users...." for further details.
_

And http://localhost:4200 not found .

How can i solve ?

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._

Was this page helpful?
0 / 5 - 0 ratings