Test rebuild fail with Angular 4 and @angular/cli 1.6.5
See original GitHub issueVersions
node v8.9.0
yarn v1.3.2
@angular/cli v1.6.2 to v1.6.5
Repro steps
- Step 1 ng new application
- Step 2 change in package.json angular version to v4.4.6
- Step 3 yarn test => run fine
- Step 4 change a spec file => error (stacktrace below)
Observed behavior
It works fine with angular 5 but not with angular 4
Stacktrace :
<!-- Normally this includes a stack trace and some more information. -->
ERROR in TypeError: Cannot read property 'length' of undefined
at createSourceFile (/home/julien/projects/test-app/node_modules/typescript/lib/typescript.js:16640:110)
at parseSourceFileWorker (/home/julien/projects/test-app/node_modules/typescript/lib/typescript.js:16572:26)
at Object.parseSourceFile (/home/julien/projects/test-app/node_modules/typescript/lib/typescript.js:16521:26)
at Object.createSourceFile (/home/julien/projects/test-app/node_modules/typescript/lib/typescript.js:16371:29)
at new TypeScriptFileRefactor (/home/julien/projects/test-app/node_modules/@ngtools/webpack/src/refactor.js:79:35)
at Object.findLazyRoutes (/home/julien/projects/test-app/node_modules/@ngtools/webpack/src/lazy_routes.js:18:22)
at AotPlugin._findLazyRoutesInAst (/home/julien/projects/test-app/node_modules/@ngtools/webpack/src/plugin.js:217:50)
at _donePromise.Promise.resolve.then.then.then.then.then (/home/julien/projects/test-app/node_modules/@ngtools/webpack/src/plugin.js:496:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Same thing with --sm=false
Desired behavior
It should rebuild without error with angular 4.X.X
Mention any other details that might be useful (optional)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:22
- Comments:40
Top Results From Across the Web
Angular CLI Error: The serve command requires to be run in ...
Angular Cli Error : The serve command requires to be run in an Angular project, but a project definition could not be found....
Read more >CLI Overview and Command Reference - Angular
build, b. Compiles an Angular application or library into an output directory named dist/ at the given output path. ; cache. Configure persistent...
Read more >Angular 5 Tutorial: Guide to Your First Angular 5 App - Toptal
Build a notes application from scratch for your first Angular 5 app. Learn Angular CLI, use RxJS, implement Firebase as the back-end, and...
Read more >How To Update Angular CLI To Latest Version
After updating Angular CLI globally you might get this warning if your local project's angular cli version less than the global angular cli...
Read more >the installed angular cli version is older than the latest stable ...
The installed Angular CLI version is older than the latest stable version. Installing a temporary version to perform the update. Installing packages for...
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
This seems to be related to a change in the
compiler_host.ts
of@ngtools/webpack
. See how this commit changes theinvalidate
function - line 177.I fixed it by adapting the function in my node_modules (
node_modules/@ngtools/webpack/src/compiler_host.js
):Original:
Adapted:
We have added a shell script that replaces this on
npm start
for every developer:@dominique-mueller in this one it works fine first time.
Second time it seems to be looking at directory instead of file…