Angular-cli: ng serve is giving errors for a basic project created by ng new

Created on 11 Feb 2017  Â·  9Comments  Â·  Source: angular/angular-cli

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Mac OSX EI Capitan

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

Repro steps.

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

Nothng

The log given by the failure.

Normally this include a stack trace and some more information.

Mention any other details that might be useful.

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (../a/node_modules/@ngtools/webpack/src/index.js:5:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.../a/node_modules/angular-cli/models/webpack-build-typescript.js:5:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (../a/node_modules/angular-cli/models/webpack-config.js:2:34)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (../a/node_modules/angular-cli/tasks/build-webpack.js:6:24)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (..

/a/node_modules/angular-cli/commands/build.js:3:23)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Class.module.exports.includedCommands (/../a/node_modules/angular-cli/addon/index.js:21:16)
at ..a/node_modules/angular-cli/lib/models/project.js:392:61
at Array.forEach (native)
at Project.addonCommands (../a/node_modules/angular-cli/lib/models/project.js:391:15)
at Project.eachAddonCommand (../a/node_modules/angular-cli/lib/models/project.js:426:30)
at module.exports (../a/node_modules/angular-cli/lib/cli/lookup-command.js:33:13)
at CLI. (..a/node_modules/angular-cli/lib/cli/cli.js:34:26)
at tryCatch (../a/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (../a/node_modules/rsvp/dist/rsvp.js:553:13)
at publish (../a/node_modules/rsvp/dist/rsvp.js:521:7)
at flush ..a/node_modules/rsvp/dist/rsvp.js:2373:5)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)


Thanks! We'll be in touch soon.

Most helpful comment

its crashed if your use old nodejs version in OS.

If your OS ubuntu, use https://github.com/nodesource/distributions#deb

new angular/@cli requests nodejs ver. 6.9.x

I solve this problem use repo in link. Install to my ubuntu node 6.9 and all works fine!

All 9 comments

I am having the same problem. Ng serve will not start server after generating a new file using the cli. I am running the beta 31. Here is my error:

You have to be inside an angular-cli project in order to use the serve command.

I am starting the serve in the same directory I normally do.

its crashed if your use old nodejs version in OS.

If your OS ubuntu, use https://github.com/nodesource/distributions#deb

new angular/@cli requests nodejs ver. 6.9.x

I solve this problem use repo in link. Install to my ubuntu node 6.9 and all works fine!

Did the same in Mac and it is working now with node 6.

Updating node Fixed it for me.

Thnx all :)

On Tue, Feb 14, 2017 at 7:53 AM, awsaunier notifications@github.com wrote:

Updating node Fixed it for me.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/4620#issuecomment-279518725,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEf2xXf1sTPNmq5-k1NmF43Bk6Mtow9zks5rcMLigaJpZM4L-L7H
.

--

Best Regards,
Sarah Tabassum

Hi, I was facing the same issue few mins back. Then I have updated node from 4.2 to 7.x.
And now getting below error

"Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token / in JSON at position 163"

Hi, I was facing the same issue few mins back.

/usr/local/lib/node_modules/@angular/cli/models/config/config.js:17
constructor(_configPath, schema, configJson, fallbacks = []) {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

I'm trying to run serve -s build and see this error. Has anyone else seen this one? Thanks!

/usr/local/lib/node_modules/serve/bin/serve.js:12
const { coroutine } = require('bluebird')
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3

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