Closed WandererInVoids closed 6 years ago
the same, v6.1.2 is broken.
downgrade to
"@angular/compiler-cli": "6.1.1",
I have exactly the same problem, and reverting @angular/compiler
"fixes" the problem.
Hey,
This issue can also reproduce as follows:
ng new ngApp --routing && cd ngApp ng serve --aot change a file under watch
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '@angular/router.ngfactory' in '/Users/vchimev/Work/tmp/ngApp/src/app'
ℹ 「wdm」: Failed to compile.
Causes https://github.com/NativeScript/nativescript-dev-webpack/issues/630.
I have exactly the same problem with Angular CLI: 6.1.3
Added to the top of our backlog
I was unable to replicate this with the following versions. Can you try with the versions listed below? For existing projects, please ensure that @angular-devkit/build-angular
is updated; upgrading the CLI does not automatically update @angular-devkit/build-angular
.
Angular CLI: 6.1.3
Node: 8.9.4
OS: darwin x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.3
@angular-devkit/build-angular 0.7.3
@angular-devkit/build-optimizer 0.7.3
@angular-devkit/build-webpack 0.7.3
@angular-devkit/core 0.7.3
@angular-devkit/schematics 0.7.3
@angular/cli 6.1.3
@ngtools/webpack 6.1.3
@schematics/angular 0.7.3
@schematics/update 0.7.3
rxjs 6.2.2
typescript 2.7.2
webpack 4.9.2
@clydin i used this:
Angular CLI: 6.1.3
Node: 10.8.0
OS: win32 x64(windows 10)
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.3
@angular-devkit/build-angular 0.7.3
@angular-devkit/build-optimizer 0.7.3
@angular-devkit/build-webpack 0.7.3
@angular-devkit/core 0.7.3
@angular-devkit/schematics 0.7.3
@angular/cdk 6.4.3
@angular/cli 6.1.3
@angular/material 6.4.3
@ngtools/webpack 6.1.3
@schematics/angular 0.7.3
@schematics/update 0.7.3
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2
also i used ng server without bazel, same error when updated.
my tsconfig
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"listEmittedFiles":true,
"lib": ["es6", "dom", "es2016.array.include"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": false,
"target": "es5",
"alwaysStrict": true,
"typeRoots": [
"../node_modules/@types"
]
},
"angularCompilerOptions": {
"preserveWhitespaces": false
}
}
serve config
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "homeapp:build"
},
"configurations": {
"production": {
"browserTarget": "homeapp:build:production"
}
}
},
command : ng serve --aot --source-map=false
it happen time to time just change file few times. U will see it.
As a test, every watched file in a new project was changed twice with both TS 2.7.2 and TS 2.9.2; and was unable to reproduce. Two files were also changed 5 times each (a component and a module) with the same outcome. To fully diagnose the issue, a minimal reproduction or exact steps to trigger the issue will be needed in light of the inability to reproduce.
@clydin can u try this https://github.com/angular/angular-cli/issues/11835#issuecomment-412009587, u changed file while server active?
Thanks. Traced the issue to this PR in angular itself: https://github.com/angular/angular/pull/25335
This change was introduced within @angular/compiler
in version 6.1.2.
Same issue confirmed, and the only solution for AOT so far is back to use 6.1.1
any progress? With this i can`t test angular 7 beta
For me this issue even with 6.1.1 (6.1.0 all was fine)
@deerua Can you share your package.json
to see if any conflicts?
Sure
"dependencies": {
"@angular/animations": "^6.1.1",
"@angular/cdk": "^6.4.1",
"@angular/common": "^6.1.1",
"@angular/compiler": "^6.1.1",
"@angular/core": "^6.1.1",
"@angular/forms": "^6.1.1",
"@angular/http": "^6.1.1",
"@angular/material": "^6.4.1",
"@angular/platform-browser": "^6.1.1",
"@angular/platform-browser-dynamic": "^6.1.1",
"@angular/platform-server": "^6.1.1",
"@angular/router": "^6.1.1",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^6.0.1",
"@ngrx/router-store": "^6.0.1",
"@ngrx/store": "^6.0.1",
"@ngrx/store-devtools": "^6.0.1",
"@nguniversal/common": "6.0.0",
"@nguniversal/express-engine": "6.0.0",
"@nguniversal/module-map-ngfactory-loader": "6.0.0",
"@ngx-translate/core": "10.0.2",
"@ngx-translate/http-loader": "^3.0.1",
"@types/angular": "1.6.45",
"@types/cheerio": "^0.22.7",
"@types/compression": "0.0.36",
"@types/googlemaps": "^3.30.8",
"angular-calendar": "0.25.1",
"cheerio": "^1.0.0-rc.2",
"compression": "^1.7.2",
"core-js": "2.5.1",
"cross-env": "https://registry.npmjs.org/cross-env/-/cross-env-5.1.4.tgz",
"date-fns": "1.29.0",
"express-winston": "latest",
"hammerjs": "2.0.8",
"immer": "^1.5.0",
"jasmine-console-reporter": "^3.0.2",
"karma-failed-reporter": "0.0.3",
"localize-router": "https://github.com/manzonif/temp-localize-router/archive/a45b7b3f1eebfe82e3093e0b6cd5bb00612e9bb6.tar.gz",
"mobile-detect": "1.4.1",
"ngrx-store-localstorage": "5.0.1",
"ngx-lazy-load-images": "^1.3.1",
"ngx-translate-parser-plural-select": "1.1.3",
"preboot": "6.0.0-beta.4",
"request": "^2.83.0",
"rxjs": "^6.2.2",
"rxjs-tslint": "^0.1.5",
"ts-action": "^6.0.2",
"ts-action-operators": "^7.0.0",
"ts-loader": "^4.4.2",
"ts-md5": "^1.2.4",
"winston": "^2.4.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.7.3",
"@angular/cli": "^6.1.1",
"@angular/compiler-cli": "^6.1.1",
"@angular/flex-layout": "^6.0.0-beta.17",
"@angular/language-service": "^6.1.1",
"@compodoc/compodoc": "1.1.3",
"@ngrx/schematics": "^6.0.1",
"@storybook/addon-notes": "4.0.0-alpha.14",
"@storybook/addon-options": "4.0.0-alpha.14",
"@storybook/addon-viewport": "4.0.0-alpha.14",
"@storybook/addons": "4.0.0-alpha.14",
"@storybook/angular": "4.0.0-alpha.14",
"@types/express": "^4.11.1",
"@types/express-winston": "^2.4.0",
"@types/hammerjs": "2.0.34",
"@types/jasmine": "2.5.38",
"@types/lodash": "^4.14.95",
"@types/node": "6.0.60",
"@types/request": "^2.47.0",
"@types/storybook__addon-notes": "^3.3.1",
"angular-playground": "1.7.1",
"babel-core": "^6.26.0",
"codelyzer": "4.2.1",
"concurrently": "^3.5.1",
"enhanced-resolve": "3.3.0",
"jasmine-core": "2.5.2",
"jasmine-marbles": "^0.3.1",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-verbose-reporter": "0.0.6",
"localstorage-polyfill": "^1.0.1",
"node-pre-gyp": "0.6.39",
"node-sass": "4.9.2",
"rxjs-compat": "^6.2.2",
"rxjs-tslint-rules": "^3.9.0",
"sass-lint": "1.12.1",
"source-map-explorer": "1.5.0",
"ts-node": "4.1.0",
"tslint": "5.9.1",
"tslint-eslint-rules": "4.1.1",
"typescript": "^2.9.0",
"webpack-bundle-analyzer": "2.9.1",
"webpack-cli": "^3.0.8"
},
After some changes we have 183 ERRORS Most of it
Module not found: Error: Can't resolve '@angular/router.ngfactory'
and all material components
^6.1.1
means install the latest version of 6.x (with a minimum of 6.1.1) which would be 6.1.2
As a temporary workaround, you can fix @angular/compiler
to 6.1.1 (note you will receive peer dependency warnings). You can also stay on Angular 6.1.1 as a whole until a fix is available. Also when building for production, moving to consistent versions would be advised (i.e., all 6.1.1 or all 6.1.2).
Note also that CLI and @angular-devkit/build-angular can be at their latest version.
thx @clydin i have checked node_modules manually before and all the deps. was 6.1.1 :) in package.json, strange but after strict version all become fine (looks like)
The same issue after update to 6.1.2. Downgrade to 6.1.1 helped
Been fighting with this for about a week now. I can confirm this package.json fixes all issues (made with npm i -g @angular/cli@6.1.1
then manually edited):
{
"name": "admin",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --aot",
"build": "ng build --aot --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "6.1.1",
"@angular/common": "6.1.1",
"@angular/compiler": "6.1.1",
"@angular/core": "6.1.1",
"@angular/forms": "6.1.1",
"@angular/http": "6.1.1",
"@angular/platform-browser": "6.1.1",
"@angular/platform-browser-dynamic": "6.1.1",
"@angular/router": "6.1.1",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.7.0",
"@angular/cli": "6.1.1",
"@angular/compiler-cli": "6.1.1",
"@angular/language-service": "6.1.1",
"@types/node": "~8.9.4",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
is the problem fixed in @angular/compiler@6.1.3?
It wasn't fixed in 6.1.3. I just checked it.
Still not fixed with 6.1.4 right?
This problem wasn't fixed in 6.1.4 I have this in @angular/cli >= 6.1.0
We're looking at this issue at the moment.
Steps to reproduce:
ng new repro-proj
@angular/compiler@6.1.2
or aboveRouterModule
to src/app/app.module.ts
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component'; import { environment } from '../environments/environment';
@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, RouterModule, ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
- run `ng serve --aot`
- save `src/app/app.module.ts` (no change in it needed)
- see the following error:
ERROR in ./src/app/app.module.ngfactory.js Module not found: Error: Can't resolve '@angular/router.ngfactory' in 'D:\sandbox\latest-project\src\app'
This problem seems to have been introduced in https://github.com/angular/angular/pull/25335, and is the same as reported in https://github.com/angular/angular/issues/25424.
I inspected the contents of `src/app/app.module.ngfactory.js` and what happens is that in the initial build it contains this import:
import * as i3 from "../../node_modules/@angular/router/router.ngfactory";
but in the rebuild the import is changed to
import * as i3 from "@angular/router.ngfactory";
I checked if the same happens happens with just `ngc`, and it doesn't.
Still investigating further.
i'm experiencing this same problem with 6.1.0
@elmartino
This is weird, please share your package.json
.
@elmartino
I see, it seems you are no using exactly 6.1.0
, please follow the instruction at https://github.com/angular/angular-cli/issues/11835#issuecomment-413262460
Had some trouble with the JSON markup, but you saw it already :-) changing "@angular/compiler": "^6.1.0", to "@angular/compiler": "6.1.0", working now. Thanks!
@filipesilva Would it be possible to cover this with integration tests in the future, given that it is very easy to reproduce?
This appears to be fixed by the Angular 6.1.6 release today.
I confirm that this issued is fixed in Angular v6.1.6.
When will be the NPM release?
@rickvandermeij-aanzee yesterday.
didn't notice the fix is at @angular/compiler-cli
@rickvandermeij-aanzee because it's in angular, not cli.
Fixed via https://github.com/angular/angular/pull/25604, released in @angular/compiler@6.1.6
.
I'm still getting this issue on both @6.1.0
and @6.1.6
. Both @angular/compiler
and @angular/compiler-cli
were set to those versions. Is anyone else still experiencing this?
@jgf5013 nope, since 6.1.6
everything works fine for me.
@jgf5013 make sure that you have the latest versions specified, then delete node_modules folder and do an npm install.
Hmm, still no luck. Cleared out node_modules folder and re-ran npm install
. Checked the installed versions of @angular/compiler
and @angular/compiler-cli
directly in their package.json
files and confirmed both are set to 6.1.6
. Also tried updating to @latest
for these two deps. which updated them to 6.1.7
but the issue was still there.
Just to be clear, I can build and serve the app without issue using ng serve <appname>
and ng build <appname>
commands but both ng serve <appname> --aot
and ng build <appname> --prod
fail.
Could it make a difference that the app is a hybrid Angular/AngularJS app?
package.json
file below...
{
"name": "appname",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prettier:write": "prettier --write \"projects/**/*.ts\""
},
"private": true,
"dependencies": {
"@angular/animations": "^6.1.6",
"@angular/cdk": "^6.4.3",
"@angular/common": "^6.1.6",
"@angular/core": "^6.1.6",
"@angular/forms": "^6.1.6",
"@angular/http": "^6.1.6",
"@angular/material": "^6.4.4",
"@angular/platform-browser": "^6.1.6",
"@angular/platform-browser-dynamic": "^6.1.6",
"@angular/router": "^6.1.6",
"@angular/upgrade": "^6.1.6",
"@ngrx/effects": "^6.1.0",
"@ngrx/entity": "^6.1.0",
"@ngrx/router-store": "^6.1.0",
"@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0",
"@types/angular": "^1.6.50",
"@uirouter/angular-hybrid": "^6.0.2",
"angular": "^1.7.3",
"angular-file-upload": "^2.5.0",
"angular-smart-table": "^2.1.11",
"angular-strap": "^2.3.12",
"angular-toastr": "^2.1.1",
"angular-ui-grid": "^4.6.3",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"d3": "^3.5.10",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"papaparse": "^4.6.0",
"ramda": "^0.25.0",
"rx-angular": "^1.1.3",
"rxjs": "^6.0.0",
"ui-select": "^0.19.8",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.7.5",
"@angular/cli": "^6.1.5",
"@angular/compiler": "^6.1.6",
"@angular/compiler-cli": "^6.1.6",
"@angular/language-service": "6.1.6",
"@ngrx/schematics": "^6.1.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.9.3",
"prettier": "^1.14.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.9.2"
}
}
Just now reading through the docs on compiling hybrid apps... yea, seems like issue for me is due to missed steps in configuration for aot/hybrid app - namely that arrow functions can't be used. Thanks for the feedback all!
This was angular core issue and fixed in @angular/core 6.1.7
I am still getting the Module not found Error.
node 10.11.0 npm 6.4.1
"@angular/common": "^6.1.8",
"@angular/core": "^6.1.8",
"@angular/compiler": "^6.1.8",
"@angular/animations": "^6.1.8",
"@angular/forms": "^6.1.8",
"@angular/http": "^6.1.8",
"@angular/platform-browser": "^6.1.8",
"@angular/platform-browser-dynamic": "^6.1.8",
"@angular/router": "^6.1.8",
"@angular/cli": "~6.2.3",
"@angular/compiler-cli": "^6.1.8",
"@angular/language-service": "^6.1.8",
I also still have problems with angular 6.1.9
"@angular/animations": "6.1.9", "@angular/cdk": "^6.4.2", "@angular/common": "6.1.9", "@angular/compiler": "6.1.9", "@angular/core": "6.1.9", "@angular/flex-layout": "^6.0.0-beta.17", "@angular/forms": "6.1.9", "@angular/http": "6.1.9", "@angular/material": "^6.4.2", "@angular/material-moment-adapter": "^6.4.2", "@angular/platform-browser": "6.1.9", "@angular/platform-browser-dynamic": "6.1.9", "@angular/router": "6.1.9", "ajv": "^6.5.2", "angular-in-memory-web-api": "^0.6.0", "bootstrap": "^4.1.0", "core-js": "^2.5.5", "d3-ng2-service": "^2.2.0", "hammerjs": "^2.0.8", "jquery": "^3.3.1", "lodash": "^4.17.5", "moment": "^2.22.2", "node-sass": "^4.9.2", "popper.js": "^1.14.3", "pump": "^2.0.1", "rxjs": "^6.3.3", "rxjs-compat": "^6.2.1", "zone.js": "~0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.6.8", "@angular/cli": "^6.1.2", "@angular/compiler-cli": "6.1.9", "@angular/language-service": "6.1.9", "@types/hammerjs": "^2.0.35", "@types/jasmine": "^2.8.6", "@types/jasminewd2": "~2.0.2", "@types/node": "^9.4.7", "codelyzer": "^4.2.1", "igniteui-angular": "^6.1.0", "jasmine-core": "~2.9.1", "jasmine-spec-reporter": "~4.2.1", "karma": "^2.0.5", "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.4.2", "karma-jasmine": "^1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "^5.3.1", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "^2.9.0"
@Charlyo @Andrii-A Did you check whether you've installed angular as a global package and if it's upgraded to 6.x?
npm ls --global --depth=0
@Charlyo @Andrii-A Did you check whether you've installed angular as a global package and if it's upgraded to 6.x?
npm ls --global --depth=0
This is the output that I get
/usr/local/lib ├── @angular/cli@6.2.3 ├── interface2@0.0.0 -> /Users/charlyo/ANIS/interface └── npm@6.4.1
npm ERR! peer dep missing: @angular/core@^5.0 || ^4.0 || ^2.0, required by d3-ng2-service@2.2.0 npm ERR! peer dep missing: typescript@~2.4.0 || ~2.5.0 || ~2.6.0 || ~2.7.0, required by @ngtools/webpack@6.0.8
C:\Users\a\AppData\Roaming\npm +-- @angular/cli@6.0.8 +-- angular-cli@1.0.0-beta.19-3 +-- bower@1.8.2 +-- generator-ng2-webpack@0.6.6 +-- grunt-cli@1.2.0 +-- grunt-init@0.3.2 +-- npm@6.4.1 +-- windows-build-tools@1.3.2 `-- yo@1.8.5
Same here (Angular 6.1.10):
$ ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.2.4
Node: 8.11.1
OS: win32 x64
Angular: 6.1.10
Ouput:
i 「wdm」: Compiled successfully.
i 「wdm」: Compiling...
C:\PROJECT_PATH\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:92
throw data[0];
^
Error: ENOENT: no such file or directory, stat 'C:\PROJECT_PATH\src\app\@shared\sr-only\sr-only.component.ngfactory.js'
at Object.fs.statSync (fs.js:948:11)
Workaround angular-cli@6.0.0 Workaround angular-cli@6.2.5
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
Angular CLI: 6.1.2 Node: 10.0.0 OS: win32 x64 Angular: 6.1.2 ... animations, cli, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, platform-server, router ... service-worker
Package Version
@angular-devkit/architect 0.7.2 @angular-devkit/build-angular 0.7.2 @angular-devkit/build-optimizer 0.7.2 @angular-devkit/build-webpack 0.7.2 @angular-devkit/core 0.7.2 @angular-devkit/schematics 0.7.2 @angular/cdk 6.4.3 @angular/material 6.4.3 @ngtools/webpack 6.1.2 @schematics/angular 0.7.2 @schematics/update 0.7.2 rxjs 6.2.2 typescript 2.9.2 webpack 4.9.2 -->
Repro steps
The log given by the failure
Desired functionality
work as before update
Mention any other details that might be useful
I didn't know where to write, in @angular/compile or here but error showed in cli, so... This breaking from this fix https://github.com/angular/angular/pull/25335. Reverting
@angular/compiler
to 6.1.1 workaround for this. I tested without fix, it work as before.