danrevah / ngx-pipes

⚡️ Useful pipes for Angular with no external dependencies!
https://danrevah.gitbooks.io/angular-pipes
MIT License
1.6k stars 203 forks source link

Module build failed #46

Closed dearibujar closed 7 years ago

dearibujar commented 7 years ago
ERROR in ./~/ngx-pipes/src/app/index.ts
Module build failed: TypeError: Cannot read property 'text' of undefined
    at Object.getTokenPosOfNode (C:\Projects\start.slog.no-ng2\node_modules\typescript\lib\typescript.js:6635:71)
    at IdentifierObject.TokenOrIdentifierObject.getStart (C:\Projects\start.slog.no-ng2\node_modules\typescript\lib\typescript.js:78683:23)
    at IdentifierObject.TokenOrIdentifierObject.getText (C:\Projects\start.slog.no-ng2\node_modules\typescript\lib\typescript.js:78704:77)
    at refactor.findAstNodes.filter (C:\Projects\start.slog.no-ng2\node_modules\@ngtools\webpack\src\loader.js:139:44)
    at Array.filter (native)
    at refactor.findAstNodes.forEach.node (C:\Projects\start.slog.no-ng2\node_modules\@ngtools\webpack\src\loader.js:138:14)
    at Array.forEach (native)
    at _removeDecorators (C:\Projects\start.slog.no-ng2\node_modules\@ngtools\webpack\src\loader.js:129:10)
    at Promise.resolve.then (C:\Projects\start.slog.no-ng2\node_modules\@ngtools\webpack\src\loader.js:292:33)
 @ ./src/$$_gendir/app/app.module.ngfactory.ts 40:0-52
 @ ./src/main.ts
 @ multi ./src/main.ts

I am using angular cli

danrevah commented 7 years ago

Which version of angular-cli and angular are you using ?

dearibujar commented 7 years ago

"@angular/cli": "1.0.0-rc.1", "@angular/core": "2.4.6",

danrevah commented 7 years ago

What about your ngx-pipes version? is that updated to the latest?

I've just installed "@angular/cli": "1.0.0-rc.1" and everything works fine. (although I would recommend updating to 1.0.0).

Package.json:

{
  "name": "project",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.4.6",
    "@angular/compiler": "^2.4.6",
    "@angular/core": "^2.4.6",
    "@angular/forms": "^2.4.6",
    "@angular/http": "^2.4.6",
    "@angular/platform-browser": "^2.4.6",
    "@angular/platform-browser-dynamic": "^2.4.6",
    "@angular/router": "^3.4.0",
    "core-js": "^2.4.1",
    "ngx-pipes": "^1.5.7",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-rc.1",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }
}
juanmazalazar commented 7 years ago

I have the same problem deploying in heroku, I tried with you package too. In my local machine it works fine!

Lyasan commented 7 years ago

Getting same error, but only if I use ng build --prod

My package.json:

"dependencies": {
    "@angular/cli": "1.0.0-rc.1",
    "@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/flex-layout": "^2.0.0-beta.7",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/material": "^2.0.0-beta.3",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@types/datejs": "~0.0.29",
    "@types/hammerjs": "^2.0.34",
    "core-js": "^2.4.1",
    "d3-ng2-service": "^1.8.0",
    "datejs": "^1.0.0-rc3",
    "hammerjs": "^2.0.8",
    "ngx-pipes": "1.5.4",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "typescript": "2.2.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.47",
    "@types/node": "~6.0.60",
    "angular-in-memory-web-api": "^0.3.1",
    "codelyzer": "~2.1.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-coverage-istanbul-reporter": "^1.0.0",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.6.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0"
  }
danrevah commented 7 years ago

@Lyasan I've used your package.json dependecies, and I got the same error with ng build --prod. but it looks like it does work for me when updating to the official release of angular/cli -> "@angular/cli": "1.0.0".

Does this fix it for you as well?

@juanmazalazar you're probably having the same issue with Heroku since you're using ng build --prod ? try updating your @angular/cli package as well

dearibujar commented 7 years ago

I updated both angular/cli and angular/core to 4.0 now everything works

danrevah commented 7 years ago

Great! the problem was only because of @angular/cli. but updating to Angular 4 is a good idea this days 👍

@juanmazalazar @Lyasan keep me updated as well if it works

juanmazalazar commented 7 years ago

@danrevah It's works with A4, and Acli 1.0.0. Thanks!

But now, I have warning with fontawesome, maybe changes something in Angular4.

11% building modules 9/15 modules 6 active ...fonts/fontawesome-webfont.ttf?v=4.7.0Template parse warnings: remote: The <template> element is deprecated. Use <ng-template> instead (" remote: <div class="card"> remote: [WARNING ->]<template ngFor let-panel [ngForOf]="panels">

danrevah commented 7 years ago

it's not related to ngx-pipes but it's pretty straight forward it's telling you to use ng-template instead of template.

danrevah commented 7 years ago

I'm closing this for now, looks like it's resolved.