angular-cli: -prod option fails with cryptic error since upgrade to >0.0.34

  1. OS. Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
  • Windows 10. All consoles are run in admin mode.
  • Mint Linux 17.3 on x64
  1. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal:

    $ ng --version
    (node:7172) 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.
    angular-cli: 1.0.0-beta.1
    node: 6.1.0
    os: win32 x64

Plus, for completeness…

$ node --version; npm --version; npm info angular-cli

{ name: 'angular-cli',
   { modified: '2016-05-07T16:07:33.383Z',
     created: '2014-10-07T04:34:38.078Z',
     '1.0.0': '2014-10-07T04:34:38.078Z',
     '0.0.0': '2014-10-11T11:38:24.914Z',
     '0.0.1': '2015-08-03T17:12:04.553Z',
     '0.0.2': '2015-10-18T17:46:40.146Z',
     '0.0.3': '2015-10-18T21:42:52.445Z',
     '0.0.4': '2015-10-19T01:14:13.216Z',
     '0.0.5': '2015-10-19T09:14:01.712Z',
     '0.0.6': '2015-10-19T09:36:51.644Z',
     '0.0.7': '2015-10-19T11:48:24.233Z',
     '0.0.8': '2015-10-19T11:51:59.318Z',
     '0.0.9': '2015-10-19T21:18:13.725Z',
     '0.0.10': '2015-10-19T22:18:13.091Z',
     '0.0.11': '2015-11-03T05:03:06.345Z',
     '0.0.12': '2015-11-15T10:10:48.551Z',
     '0.0.13': '2015-12-04T17:16:43.662Z',
     '0.0.14': '2015-12-05T01:40:39.377Z',
     '0.0.15': '2015-12-05T05:50:59.226Z',
     '0.0.16': '2015-12-10T12:23:28.722Z',
     '0.0.17': '2015-12-14T19:37:08.400Z',
     '0.0.18': '2015-12-15T12:51:47.990Z',
     '0.0.19': '2015-12-15T18:23:33.077Z',
     '0.0.20': '2015-12-15T20:39:55.357Z',
     '0.0.22': '2016-02-20T00:36:56.908Z',
     '0.0.23': '2016-02-20T01:44:13.897Z',
     '0.0.24': '2016-02-25T17:41:20.619Z',
     '0.0.25': '2016-03-10T02:10:05.410Z',
     '0.0.26': '2016-03-23T00:39:46.402Z',
     '0.0.27': '2016-03-23T22:05:56.538Z',
     '0.0.28': '2016-03-28T22:39:45.766Z',
     '0.0.29': '2016-03-30T18:10:47.060Z',
     '0.0.30': '2016-04-06T22:27:32.015Z',
     '0.0.31': '2016-04-11T18:20:32.677Z',
     '0.0.33': '2016-04-19T22:31:48.209Z',
     '0.0.34': '2016-04-26T17:56:20.524Z',
     '0.0.37': '2016-05-03T18:49:21.731Z',
     '0.0.39': '2016-05-04T16:29:23.054Z',
     '0.1.0': '2016-05-05T19:41:05.830Z',
     '1.0.0-beta.0': '2016-05-06T18:18:54.950Z',
     '1.0.0-beta.1': '2016-05-07T16:07:33.383Z' },
   [ 'angularcore <>',
     'rodyhaddad <>' ],
  description: 'CLI tool for Angular',
   [ '0.0.0',
     '1.0.0-beta.1' ],
  'dist-tags': { latest: '1.0.0-beta.1', beta: '1.0.0-beta.1' },
  readmeFilename: '',
  homepage: '',
  keywords: [],
   { type: 'git',
     url: 'git+' },
  author: 'Angular Authors',
  bugs: { url: '' },
  license: 'MIT',
   [ 'Rody Haddad <> (',
     'Igor Minar <>' ],
  users: { altrim: true, seachange: true },
  version: '1.0.0-beta.1',
  main: 'lib/cli/index.js',
  trackingCode: 'UA-8594346-19',
  bin: { ng: './bin/ng' },
  scripts: { test: 'node tests/runner', lint: 'eslint .' },
  engines: { node: '>= 4.1.0' },
   { broccoli: '^1.0.0-beta.7',
     'broccoli-caching-writer': '^2.2.1',
     'broccoli-concat': '^2.2.0',
     'broccoli-funnel': '^1.0.1',
     'broccoli-merge-trees': '^1.1.1',
     'broccoli-source': '^1.1.0',
     'broccoli-writer': '^0.1.1',
     chalk: '^1.1.3',
     'ember-cli': '2.5.0',
     'ember-cli-string-utils': '^1.0.0',
     exit: '^0.1.2',
     'fs-extra': '^0.30.0',
     glob: '^7.0.3',
     leek: '0.0.21',
     lodash: '^4.11.1',
     opn: '4.0.1',
     resolve: '^1.1.7',
     shelljs: '^0.7.0',
     'silent-error': '^1.0.0',
     'symlink-or-copy': '^1.0.3',
     'systemjs-builder': '^0.15.16',
     typescript: '^1.8.10',
     typings: '^0.8.1' },
  'ember-addon': { paths: [ './addon/ng2/' ] },
   { chai: '^3.5.0',
     'clang-format': '^1.0.38',
     eslint: '^2.8.0',
     'exists-sync': '0.0.3',
     minimatch: '^3.0.0',
     mocha: '^2.4.5',
     'mock-fs': '^3.8.0',
     'object-assign': '^4.0.1',
     rewire: '^2.5.1',
     sinon: '^1.17.3',
     through: '^2.3.8',
     tslint: '^3.8.1',
     'walk-sync': '^0.2.6' },
  gitHead: '668ecee86bc9acbf5fc41994802eb263b8b9c4aa',
   { shasum: '86feceee719d7a14579ab4486ca3077a1a80a840',
     tarball: '' },
  directories: {} }
  1. Repro steps. Tell us exactly what you did and how you came to the failure.

after upgrading our project to angular2 rc.1 and angular-cli 1.0.0-beta, the -prod option no longer works. We get a completely mysterious error message which does not give us enough information to even guess at what the problem is:

$ ng server --prod
(node:7152) 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:49152
Serving on http://localhost:4200/
(node:7152) DeprecationWarning: 'root' is deprecated, use 'global'
(node:7152) DeprecationWarning: 'GLOBAL' is deprecated, use 'global'
The Broccoli Plugin: [BundlePlugin] failed with:
Error on fetch for main at file:///D:/<elided>/nms-gui/tmp/bundle_plugin-input_base_path-ZohVXdOM.tmp/0/main
        Error: ENOENT: no such file or directory, open 'D:\<elided>\nms-gui\tmp\bundle_plugin-input_base_path-ZohVXdOM.tmp\0\main'
    at Error (native)

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

(We see the same with node 4.4.3 and 5.x)

All of the classes referenced there come from/via a2 and/or angular-cli - none of them are from our tree.

If you can give us steps from the moment you created an empty application, even better!

Unfortunately this does not happen with a clean-slate (ng new) app, but:

a) we updated our application by using (ng new) and copying our sources over to the new tree.

b) non-prod builds and runs just fine, so we have to assume the problem is somewhere internally in the handling of the prod environment (which we do not manipulate, other than to add 2 empty functions to the environment object in config/ Unfortunately, ng does not support custom environment names (--environment=mine), so attempts to reproduce it (or rule it out) that way have failed.

c) we’ve gone through and compared our config files with those of a clean-slate build literally 5 times, and the only difference is that our app lives under src/client/app instead of src/app (i’m told by our maven gurus that that’s necessary for our particular build environment).

Because the error message is so cryptic (and contains no mention of classes/files from us), we have literally no idea where to start looking. Any hint for how we can tickle more info out of -prod would be much appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (8 by maintainers)

Most upvoted comments

Nice! Glad it’s working now 😄

The feedback on the environments kinda confirms the scenario we were going for. The problem with bundling for certain environments is one I’m thinking about solving by decoupling the build from the environment.

So to speak, you’d be able to do ng build -prod --env=dev and conversely ng build --env=prod. --env would merely specify which environment file to copy over, while -prod would bundle stuff/generate service worker manifest/do template compilation.