Murali Ganesh
Murali Ganesh

Reputation: 23

When I try to create a project and run Angular 6, I get an error

I created a new project based on Angular documentation. I am using the latest version of Node and NPM.

I run this code:

D:\angular-examples\testing>ng serve

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2018-09-09T11:27:36.200Z
Hash: 8e7632ec537c74fbb5ea
Time: 28220ms
chunk {main} main.js, main.js.map (main) 11.1 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.26 MB [initial] [rendered]

But I get this error:

**ERROR in ./ansi-html 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
> #!/bin/sh
| basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
i 「wdm」: Failed to compile.**

Upvotes: 1

Views: 449

Answers (1)

whitespace
whitespace

Reputation: 821

this is because # symbol is not recognized by npm. The ng command you are using to serve your project, is nothing more than a wrapper on npm. This issue is perhaps only limited to your version 6.4.1, you can switch to the LTS version of npm which is 5.6.0(included with node) or the version 6.4.0. I have tested both on my machine (osx 10.9.5) and they both work.

Upvotes: 1

Related Questions