prod build/serve fails with angular2-material
See original GitHub issue- Operating system Mac OSX El Capitan
- Versions. angular-cli: 1.0.0-beta.5 node: 4.4.5 os: darwin x64
- Repro steps.
ng new test-app
npm install --save @angular2-material/core
npm install --save @angular2-material/checkbox
angular-cli-build.js:
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-material/**/*.js'
]
});
};
src/system-config.ts
/** Map relative paths to URLs. */
const map: any = {
'@angular2-material': 'vendor/@angular2-material'
};
/** User packages configuration. */
const packages: any = {
'@angular2-material/core': {
format: 'cjs',
defaultExtension: 'js',
main: 'core.js'
},
'@angular2-material/checkbox': {
format: 'cjs',
defaultExtension: 'js',
main: 'checkbox.js'
}
};
...
src/app/test-app.component.ts
import { Component } from '@angular/core';
import { MD_CHECKBOX_DIRECTIVES } from '@angular2-material/checkbox';
@Component({
moduleId: module.id,
selector: 'test-app-app',
directives: [MD_CHECKBOX_DIRECTIVES],
templateUrl: 'test-app.component.html',
styleUrls: ['test-app.component.css']
})
export class TestAppAppComponent {
title = 'test-app works!';
}
ng build -prod
- The log given by the failure.
Build failed.
The Broccoli Plugin: [BundlePlugin] failed with:
Error on fetch for vendor/@angular2-material/checkbox/checkbox.js at file:///Users/dannyblue/Documents/projects/test-app/tmp/bundle_plugin-input_base_path-L2OPG5Mp.tmp/0/vendor/@angular2-material/checkbox/checkbox.js
Loading app/test-app.component.js
Loading app/index.js
Loading main.js
Error: ENOENT: no such file or directory, open '/Users/dannyblue/Documents/projects/test-app/tmp/bundle_plugin-input_base_path-L2OPG5Mp.tmp/0/vendor/@angular2-material/checkbox/usr/local/google/home/jelbourn/material2/tmp/broccoli_type_script_compiler-input_base_path-IydvmmBU.tmp/0/components/checkbox/checkbox.js.map'
at Error (native)
The broccoli plugin was instantiated at:
at BundlePlugin.Plugin (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
at BundlePlugin.CachingWriter [as constructor] (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
at BundlePlugin (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/lib/broccoli/angular-broccoli-bundle.js:11:10)
at Angular2App._getBundleTree (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/lib/broccoli/angular2-app.js:421:22)
at Angular2App._buildTree (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/lib/broccoli/angular2-app.js:159:21)
at new Angular2App (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
at module.exports (/Users/dannyblue/Documents/projects/test-app/angular-cli-build.js:6:10)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
at Class.module.exports.Task.extend.init (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
at new Class (/Users/dannyblue/Documents/projects/test-app/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/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
at /Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
at lib$rsvp$$internal$$tryCatch (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at /Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/Users/dannyblue/Documents/projects/test-app/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
- Mention any other details that might be useful. Other 3rd party libs like moment are working fine. I am not sure why this would only be happening with angular2-material. running things in dev mode works fine (ng server and ng build). It is happening with any and all angular2 material components. the components themselves seem to be working just fine.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Angular production build error in nx version 13.7.1 · Issue #8768
I am experiencing this same error on nx 13.6.1 after updating (via nx migrate) @angular-devkit/build-angular from 13.1.2 to 13.2.0. This is ...
Read more >Angular 5. ng build --prod works. Deployed application fails
I can compile application using ng build -prod but deployed application on apache server fails. Chrome message is: Uncaught SyntaxError: ...
Read more >Error when pass my application to universal angular
Hello, I was passing my application to universal angular, with the following guide, taking into account the section of version 8 (the project...
Read more >Deploying an application - Angular
Deploying your application is the process of compiling, or building, your code and hosting the JavaScript, CSS, and HTML on a web server....
Read more >Identify and Fix Build and Deployment Errors in Your Angular ...
In this guide, you will learn how to spot some of the most common build and deployment errors and how to resolve them...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having this problem too. Note this line from log:
'/Users/dannyblue/Documents/projects/test-app/tmp/bundle_plugin-input_base_path-L2OPG5Mp.tmp/0/vendor/@angular2-material/checkbox/usr/local/google/home/jelbourn/material2/tmp/broccoli_type_script_compiler-input_base_path-IydvmmBU.tmp/0/components/checkbox/checkbox.js.map'
See how that’s referencing @jelbourn’s path? There are sourceMappingURLs all over material2 that reference that path. Could that be tripping things up?
Edit: See: angular/material2#541
Stripping out the incorrect sourcemap refs will temporarily fix. Quick cmds to do so:
Linux:
FreeBSD/OSX:
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.