Angular-cli: ng serve -prod fails (beta 4)

Created on 19 May 2016  Â·  22Comments  Â·  Source: angular/angular-cli

Please provide us with the following information:

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

Mac OS X 10.11.4 (El Cap)

  1. Versions. Please run ng --version.

angular-cli: 1.0.0-beta.4
node: 4.4.1
os: darwin x64

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

    1. ng new ngclitest

    2. cd ngclitest

    3. ng serve works, yeah!

    4. ng serve -prod fails, boo

Zero code changes.

  1. The log given by the failure. Normally this include a stack trace and some
    more information.
$ ng serve -prod
Livereload server on http://localhost:49154
Serving on http://localhost:4200/
The Broccoli Plugin: [BundlePlugin] failed with:
Error: Error on fetch for main.js at file:///Users/bbohling/Projects/Testing/ngclitest/tmp/bundle_plugin-input_base_path-gBkw51Lq.tmp/0/main.js
    ENOENT: no such file or directory, open '/Users/bbohling/Projects/Testing/ngclitest/tmp/bundle_plugin-input_base_path-gBkw51Lq.tmp/0/Users/bbohling/Projects/Testing/ngclitest/tmp/broccoli_type_script_compiler-input_base_path-tZonLqxE.tmp/0/main.js.map'
    at Error (native)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:209:32
    at SystemJSNodeLoader.loader.fetch (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:194:6)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:425:23
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:418:8
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:388:6
    at processImmediate [as _immediateCallback] (timers.js:383:17)
    at Trace.getLoadRecord (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:131:4)
    at Trace.getAllLoadRecords (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:552:15)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:54:19
    at Trace.traceCanonical (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:52:4)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:243:35
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:232:20
    at Array.reduce (native)
    at processExpandedOperations (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:231:35)
    at exports.traceExpression (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:229:8)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:636:14
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:635:6
    at processImmediate [as _immediateCallback] (timers.js:383:17)
    at Builder.bundle (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:627:4)
    at BundlePlugin.build (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:19:20)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
    at lib$rsvp$$internal$$tryCatch (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)
From previous event:
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:483:13
From previous event:
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:388:6
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Trace.getLoadRecord (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:131:4)
    at Trace.getAllLoadRecords (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:552:15)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:54:19
From previous event:
    at Trace.traceCanonical (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/trace.js:52:4)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:243:35
From previous event:
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:232:20
    at Array.reduce (native)
    at processExpandedOperations (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:231:35)
From previous event:
    at exports.traceExpression (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/arithmetic.js:229:8)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:636:14
From previous event:
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:635:6
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Builder.bundle (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/systemjs-builder/lib/builder.js:627:4)
    at BundlePlugin.build (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:19:20)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
    at lib$rsvp$$internal$$tryCatch (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

The broccoli plugin was instantiated at:
    at BundlePlugin.Plugin (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
    at BundlePlugin.CachingWriter [as constructor] (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
    at BundlePlugin (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:11:10)
    at Angular2App._getBundleTree (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/lib/broccoli/angular2-app.js:424:22)
    at Angular2App._buildTree (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/lib/broccoli/angular2-app.js:159:21)
    at new Angular2App (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
    at module.exports (/Users/bbohling/Projects/Testing/ngclitest/angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
    at new Class (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/serve.js:15:19)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/lib/commands/serve.js:64:24
    at lib$rsvp$$internal$$tryCatch (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/Users/bbohling/Projects/Testing/ngclitest/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
  1. Mention any other details that might be useful.

Was able to reproduce more than once. ng build -prod fails too with same error.

Most helpful comment

Have the same problem under Win1064 with rc1

angular-cli: 1.0.0-beta.5
node: 4.4.3
os: win32 x64

  • ng init a fresh repo
  • ng serve works
    *ng serve -prod produces

Error on fetch for main.js at file:///C:/Users/myname/Desktop/dsad/tmp/bundle_plugin-input_base_path-QFRZngT2.tmp/0/main.js Error: ENOENT: no such file or directory, open 'C:\Users\mham\Desktop\dsad\tmp\bundle_plugin-input_base_path-QFRZngT2.tmp\0\C:\Users\myname\Desktop\dsad\tmp\broccoli_type_script_compiler-input_base_path-RsfW9bEa.tmp\0\main.js.map' at Error (native)

All 22 comments

I was pushing another issue with the same problem when I saw this one.

  1. OS

    • Debian Jessie

  2. Versions (ng --version)

    • angular-cli: 1.0.0-beta.4

    • node: 5.11.1

    • os: linux x64

  3. Repro steps:

    1. ng new test --mobile

    2. cd test

    3. ng serve --> works

    4. ng serve -prod --> fails

  4. Log:

    • Same log... (not pasted to keep this clean)

@bbohling & @ddiazpinto beta 5 was JUST published, which should revolve this issue for you, please re-test.

Closing this issue for now, but if you report back that it is not resolved, it can be reopened

you are correct, beta 5 fixes this issue. thanks!

Unfortunately I still have a very similar error on both ng serve -prod and ng build -prod using beta 5. Only difference to @bbohling and @ddiazpinto is that I¨m on Windows 10.

PS C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb> ng serve -prod
(node:13260) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Livereload server on http://localhost:49155
Serving on http://localhost:4200/
"{{content-for}}" has been deprecated and will be removed before RC.
(node:13260) DeprecationWarning: 'root' is deprecated, use 'global'
(node:13260) DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
The Broccoli Plugin: [BundlePlugin] failed with:
Error on fetch for main.js at file:///C:/Source/Acme/AcmeHooverWeb/src/AcmeHooverWeb/tmp/bundle_plugin-input_base_path-lxMpDFZE.tmp/0/main.js
        Error: ENOENT: no such file or directory, open 'C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\tmp\bundle_plugin-input_base_path-lxMpDFZE.tmp\0\C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\tmp\broccoli_type_script_compiler-input_base_path-dcgnXk4L.tmp\0\main.js.map'
    at Error (native)

The broccoli plugin was instantiated at:
    at BundlePlugin.Plugin (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\broccoli-plugin\index.js:10:31)
    at BundlePlugin.CachingWriter [as constructor] (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\broccoli-caching-writer\index.js:21:10)
    at BundlePlugin (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\broccoli\angular-broccoli-bundle.js:11:5)
    at Angular2App._getBundleTree (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\broccoli\angular2-app.js:421:22)
    at Angular2App._buildTree (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\broccoli\angular2-app.js:159:21)
    at new Angular2App (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\broccoli\angular2-app.js:53:23)
    at module.exports (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\models\builder.js:55:19)
    at Class.module.exports.Task.extend.init (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\models\builder.js:89:10)
    at new Class (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\core-object\core-object.js:18:12)
    at Class.module.exports.Task.extend.run (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\tasks\serve.js:15:19)
    at C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\angular-cli\lib\commands\serve.js:64:24
    at lib$rsvp$$internal$$tryCatch (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\rsvp\dist\rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\rsvp\dist\rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (C:\Source\Acme\AcmeHooverWeb\src\AcmeHooverWeb\node_modules\rsvp\dist\rsvp.js:1198:9)

hi,
I have the problem too unafortunaly.

Sorry that this has not resolved your issues.

@filipesilva can you take a look at this, I'm assigning it to you.

i still have same problem in beta 5

I have the same issue using beta 5 the -prod flag causes the following error

Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
Build failed.
The Broccoli Plugin: [BundlePlugin] failed with:
Error on fetch for angular2-google-maps/core.js at file:///Users/marcus/hosts/bailey_hunt/tmp/bundle_plugin-input_base_path-4yaSt0CA.tmp/0/angular2-google-maps/core.js
    Loading main.js
    Error: ENOENT: no such file or directory, open '/Users/marcus/hosts/bailey_hunt/tmp/bundle_plugin-input_base_path-4yaSt0CA.tmp/0/angular2-google-maps/core.js'
    at Error (native)

The broccoli plugin was instantiated at: 
    at BundlePlugin.Plugin (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
    at BundlePlugin.CachingWriter [as constructor] (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
    at BundlePlugin (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:10:36)
    at Angular2App._getBundleTree (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/lib/broccoli/angular2-app.js:421:22)
    at Angular2App._buildTree (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/lib/broccoli/angular2-app.js:159:21)
    at new Angular2App (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
    at module.exports (/Users/marcus/hosts/bailey_hunt/angular-cli-build.js:6:10)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
    at Class.module.exports.Task.extend.init (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
    at new Class (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
    at /Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
    at lib$rsvp$$internal$$tryCatch (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
    at /Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
    at lib$rsvp$asap$$flush (/Users/marcus/hosts/bailey_hunt/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)

Have the same problem under Win1064 with rc1

angular-cli: 1.0.0-beta.5
node: 4.4.3
os: win32 x64

  • ng init a fresh repo
  • ng serve works
    *ng serve -prod produces

Error on fetch for main.js at file:///C:/Users/myname/Desktop/dsad/tmp/bundle_plugin-input_base_path-QFRZngT2.tmp/0/main.js Error: ENOENT: no such file or directory, open 'C:\Users\mham\Desktop\dsad\tmp\bundle_plugin-input_base_path-QFRZngT2.tmp\0\C:\Users\myname\Desktop\dsad\tmp\broccoli_type_script_compiler-input_base_path-RsfW9bEa.tmp\0\main.js.map' at Error (native)

Same problem here:
angular-cli: 1.0.0-beta.5
node: 6.2.0
os: linux x64

`tetreaul@flippy:~/code/strongmanOnline$ ng build -prod
(node:19184) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
â ¸ Building(node:19184) DeprecationWarning: 'root' is deprecated, use 'global'
(node:19184) DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
Build failed.
The Broccoli Plugin: [BundlePlugin] failed with:
Error on fetch for main.js at file:///home/tetreaul/code/strongmanOnline/tmp/bundle_plugin-input_base_path-8ao4N35v.tmp/0/main.js
Error: ENOENT: no such file or directory, open '/home/tetreaul/code/strongmanOnline/tmp/bundle_plugin-input_base_path-8ao4N35v.tmp/0/home/tetreaul/code/strongmanOnline/tmp/broccoli_type_script_compiler-input_base_path-yjXEHhoK.tmp/0/main.js.map'
at Error (native)

The broccoli plugin was instantiated at:
at BundlePlugin.Plugin (/home/tetreaul/code/strongmanOnline/node_modules/broccoli-plugin/index.js:10:31)
at BundlePlugin.CachingWriter as constructor
at BundlePlugin (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:11:5)
at Angular2App._getBundleTree (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/broccoli/angular2-app.js:421:22)
at Angular2App._buildTree (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/broccoli/angular2-app.js:159:21)
at new Angular2App (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
at module.exports (/home/tetreaul/code/strongmanOnline/angular-cli-build.js:6:12)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/models/builder.js:55:19)
at Class.module.exports.Task.extend.init (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/models/builder.js:89:10)
at new Class (/home/tetreaul/code/strongmanOnline/node_modules/core-object/core-object.js:18:12)
at Class.module.exports.Task.extend.run (/home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/tasks/build.js:15:19)
at /home/tetreaul/code/strongmanOnline/node_modules/angular-cli/lib/commands/build.js:32:24
at lib$rsvp$$internal$$tryCatch (/home/tetreaul/code/strongmanOnline/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/home/tetreaul/code/strongmanOnline/node_modules/rsvp/dist/rsvp.js:1048:17)
at /home/tetreaul/code/strongmanOnline/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/home/tetreaul/code/strongmanOnline/node_modules/rsvp/dist/rsvp.js:1198:9)`

@dottodot @hmrc87 @lucastetreault I just tried reproducing on a new beta.5 project and didn't have the issue you show.

beta.5 fixed this, but if you are upgrading a beta.4 or below project then you also need to update tsconfig.json and angular-cli-build.js as seen in https://github.com/angular/angular-cli/pull/839/files for your project to work.

@dottodot re-reading your issue, it seems rather different. The failure of the build to find angular2-google-maps/core.js seems to indicate a misconfiguration in system-config.ts.

@filipesilva OK so what's wrong with this then as don't know why this would be causing the issue.

/***********************************************************************************************
 * User Configuration.
 **********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
  'angular2-cookie': 'vendor/angular2-cookie',
  'autolinker': 'vendor/autolinker/dist/Autolinker.js'
};

/** User packages configuration. */
const packages: any = {
  'angular2-cookie': { main: 'core.js', defaultExtension: 'js' },
  'angular2-google-maps': { defaultExtension: 'js' },
  'autolinker': {  defaultExtension: 'js' }
};

////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
 * Everything underneath this line is managed by the CLI.
 **********************************************************************************************/
const barrels: string[] = [
  // Angular specific barrels.
  '@angular/core',
  '@angular/common',
  '@angular/compiler',
  '@angular/http',
  '@angular/router',
  '@angular/platform-browser',
  '@angular/platform-browser-dynamic',

  // Thirdparty barrels.
  'rxjs',

  // App specific barrels.
  'app',
  'app/shared',
  /** @cli-barrel */
];

const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
  cliSystemConfigPackages[barrelName] = { main: 'index' };
});

/** Type declaration for ambient System. */
declare var System: any;

// Apply the CLI SystemJS configuration.
System.config({
  map: {
    '@angular': 'vendor/@angular',
    'rxjs': 'vendor/rxjs',
    'main': 'main.js'
  },
  packages: cliSystemConfigPackages
});

// Apply the user's configuration.
System.config({ map, packages });

@dottodot I seem to be having a similar issue. For me ng build -prod works fine on a brand new cli generated project but is failing with a similar error when I try running it on an existing one, only for me the error is in regards to one of the angular2-material files. As best I can tell my systemjs config is correct (it at least produces no errors with normal serve or build)

Same problem for me when using angular-material2.

@dottodot I'm unfamiliar with angular2-google-maps so just from your config I cannot say what's wrong. Can you open a new issue with repro steps/repository that I can tinker with?

@Zyzle @MrGoro I can investigate the angular-material2 issue, perhaps the 3rd party libs guide for material 2 is outdated. Can you also open a new issue with repro steps/repository so that I can follow that?

The original issue by @bbohling has already been solved so I'd prefer not to keep adding posts here for diferent issues.

@filipesilva Ok I'll try and put something together when I get a moment, what's confusing though is why it works without the -prod. If something was configured incorrectly I would have though it should always fail.

@filipesilva the issue I'm seeing has been solved by the fix here and seems to be angular2-material specific angular/material2#541 @MrGoro maybe its the same issue you're seeing?

Amazing :) Problem fixed! Thanks for the hint.

@filipesilva OK I've managed to get it to build without errors but when I build with -prod the angular2-google-maps isn't in the vendor directory so I can't reference it from my index.html as per the docs for maps i.e <script src="vendor/angular2-google-maps/bundles/angular2-google-maps.js"></script>

/* global require, module */

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/**/*.+(js|js.map)',
      'es6-shim/es6-shim.js',
      'reflect-metadata/**/*.+(js|js.map)',
      'rxjs/**/*.+(js|js.map)',
      '@angular/**/*.+(js|js.map)',
      'angular2-google-maps/**/*.+(js|js.map)',
      'angular2-cookie/**/*.+(js|js.map)',
      'autolinker/**/*.+(js|js.map)'
    ]
  });
};
/***********************************************************************************************
 * User Configuration.
 **********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
  'angular2-cookie': 'vendor/angular2-cookie',
  'angular2-google-maps': 'vendor/angular2-google-maps',
  'autolinker': 'vendor/autolinker/dist/Autolinker.js'
};

/** User packages configuration. */
const packages: any = {
  'angular2-cookie': { main: 'core.js', defaultExtension: 'js' },
  'angular2-google-maps': { defaultExtension: 'js' },
  'autolinker': {  defaultExtension: 'js' }
};

////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
 * Everything underneath this line is managed by the CLI.
 **********************************************************************************************/
const barrels: string[] = [
  // Angular specific barrels.
  '@angular/core',
  '@angular/common',
  '@angular/compiler',
  '@angular/http',
  '@angular/router',
  '@angular/platform-browser',
  '@angular/platform-browser-dynamic',

  // Thirdparty barrels.
  'rxjs',

  // App specific barrels.
  'app',
  'app/shared',
  /** @cli-barrel */
];

const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
  cliSystemConfigPackages[barrelName] = { main: 'index' };
});

/** Type declaration for ambient System. */
declare var System: any;

// Apply the CLI SystemJS configuration.
System.config({
  map: {
    '@angular': 'vendor/@angular',
    'rxjs': 'vendor/rxjs',
    'main': 'main.js'
  },
  packages: cliSystemConfigPackages
});

// Apply the user's configuration.
System.config({ map, packages });

Sorry finding this all pretty confusing just to include a 3rd party script.

@dottodot unfortunately, for bundling to work (and thus production builds to work) you can't import angular2-google-maps.js via a script tag. Instead you have to import it via your app and systemjs.

I agree it's not very straightforward, and making this process simpler is one of our biggest priorities right now, if not the number 1.

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

Related issues

purushottamjha picture purushottamjha  Â·  3Comments

JanStureNielsen picture JanStureNielsen  Â·  3Comments

jmurphzyo picture jmurphzyo  Â·  3Comments

IngvarKofoed picture IngvarKofoed  Â·  3Comments

sysmat picture sysmat  Â·  3Comments