Skip to content

Unexpected token ' in JSON at position 0 - After running ng-build/serve a few times #1960

Closed
@ilikeprograms

Description

@ilikeprograms

Please provide us with the following information:

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

Windows 7

  1. 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.11-webpack.8
node: 6.5.0
os: win32 x64

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

As per #1922 followed @SeekingMonkey instructions and it all worked fine.
Copies newly created files (including node_modules/ to existing project).
Ran ng-serve still worked just fine.
Migrate existing app into src/app and all worked fine.
Used Ctl + C to exit ng-serve
Tried doing ng-build and get the error.

  1. The log given by the failure. Normally this include a stack trace and some
    more information.

Unexpected token ' in JSON at position 0
SyntaxError: Unexpected token ' in JSON at position 0
at Object.parse (native)
at C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\models\find-lazy-modules.ts:29:21
at Array.map (native)
at findLoadChildren (C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\models\find-lazy-modules.ts:28:10)
at C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\models\find-lazy-modules.ts:48:9
at Array.forEach (native)
at Object.findLazyModules (C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\models\find-lazy-modules.ts:47:10)
at Object.getWebpackCommonConfig (C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\models\webpack-build-common.ts:18:43)
at new NgCliWebpackConfig (C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\models\webpack-config.ts:13:30)
at Class.run (C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\tasks\build-webpack.ts:16:22)
at Class.run (C:\Git\insight-frontend\node_modules\angular-cli\addon\ng2\commands\build.ts:49:26)
at Class. (C:\Git\insight-frontend\node_modules\angular-cli\lib\models\command.js:152:17)
at lib$rsvp$$internal$$tryCatch (C:\Git\insight-frontend\node_modules\rsvp\dist\rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (C:\Git\insight-frontend\node_modules\rsvp\dist\rsvp.js:1048:17)
at C:\Git\insight-frontend\node_modules\rsvp\dist\rsvp.js:331:11
at lib$rsvp$asap$$flush (C:\Git\insight-frontend\node_modules\rsvp\dist\rsvp.js:1198:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

  1. Mention any other details that might be useful.

Issue seems to be after doing the ng-serve and then exiting, so very strange this is happening after that point when you try to do another build/serve.


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions