Issue building with Angular CLI Error: Unexpected token: name (Angular2ImageGalleryModule)
See original GitHub issueI am receiving this error while building using ng b -prod
below:
ERROR in Unexpected value 'GalleryComponent in D:/.../node_modules/angular2-image-gallery/app/gallery/gallery.component.d.ts' declared by the module 'Angular2ImageGalleryModule in D:
/.../node_modules/angular2-image-gallery/app/angular2imagegallery.module.ts'. Please add a @Pipe/@Directive/@Component annotation.
(...) is placeholder for actual file path
Does anyone know reason for this?
package.json
...
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@angular/router": "^4.0.0",
"angular2-image-gallery": "^0.6.2",
"hammerjs": "^2.0.8",
"typescript": "^2.2.1",
"web-animations-js": "^2.2.2",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angular/cli": "^1.0.0",
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}
}
App Module
// Import necessary modules for angular application
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule, Routes } from '@angular/router';
import { MaterializeModule } from 'angular2-materialize';
import { Ng2PageScrollModule } from 'ng2-page-scroll';
import { Parallax } from 'ng2-parallax/commonjs';
import { Angular2ImageGalleryModule } from 'angular2-image-gallery';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
...
const appRoutes: Routes = [...];
@NgModule({
declarations: [...],
imports: [
BrowserModule,
MaterializeModule,
FormsModule,
HttpModule,
Angular2ImageGalleryModule,
BrowserAnimationsModule,
RouterModule.forRoot(appRoutes),
Ng2PageScrollModule.forRoot(),
],
providers: [...]
bootstrap: [ AppComponent ]
})
export class AppModule { }
npm version: 4.1.2
node version: 7.4.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
SyntaxError: Unexpected token angular-cli - Stack Overflow
You are running an outdated version of the node. You should have node 6.9.0 as per wiki. Angular CLI can now be found...
Read more >UglifyJs Unexpected token: name (Time) #6655 - GitHub
I used Angular 4.1.3 and Angular CLI 1.0.6 and I was getting similar error but insted of Time, unexpected token was PolicyMappings which...
Read more >CLI Overview and Command Reference - Angular
Configures the gathering of Angular CLI usage metrics. build, b. Compiles an Angular application or library into an output directory named dist/ at...
Read more >Setting up the local environment and workspace - Angular
This guide explains how to set up your environment for Angular development using the Angular CLI tool. It includes information about prerequisites, ...
Read more >Deployment - Angular
Build your project using the GitHub project name, with the Angular CLI command ng build and the following options, where your_project_name is the...
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 FreeTop 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
Top GitHub Comments
The compilation has worked. Thank you so much! Great work! @BenjaminBrandmeier
There still seems to be an error when compiling using
ng build --prod
Below is the error:ERROR in vendor.8131bca24d66709e3bca.bundle.js from UglifyJs Unexpected token: name (Angular2ImageGalleryModule) [vendor.8131bca24d66709e3bca.bundle.js:21638,6]