question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue building with Angular CLI Error: Unexpected token: name (Angular2ImageGalleryModule)

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bfan1256commented, Apr 14, 2017

The compilation has worked. Thank you so much! Great work! @BenjaminBrandmeier

1reaction
bfan1256commented, Apr 11, 2017

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]

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found