-
Notifications
You must be signed in to change notification settings - Fork 12k
Yarn creates incompatible @ngtools/webpack/node_modules (AppModule is not an NgModule) #6425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Changing package.json to the exact same typescript version 2.2.2 prevents the error as well. |
My guess is your yarn lock file is working against you. It probably linked TS 2.2.2 to @ngtools/webpack before the upgrade attempt and is trying to give it the same version; which is technically acceptable from a package management perspective. |
@clydin the issue is reproducible after deleting yarn.lock and node_modules folders. |
Can you provide your |
I have attached it as downloadable file to the initial comment (please note the .txt extensions which needs to be removed). |
Sorry. Didn't see it there. 1.0 doesn't support TS 2.3. You'll need to either wait for 1.1 (should be soon) or use the release candidate (1.1.0-rc.0). |
Any news on this in 2018? I'm running into this issue when deploying with Jenkins, which does a |
Are you still able to reproduce this issue with the latest CLI? |
The issue does not occur with a recent version of Angular (CLI). It was caused by the update instructions to Angular 4 suggesting to use typescript@latest, which at some point in time pointed to a version new than the one supported by Angular 4. |
Thanks for the response! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
There have been a number of reports about Angular 4 working with npm. But failing with the following error message on "ng build" when yarn has been used:
ERROR in AppModule is not an NgModule
Among the many differences in node_modules between npm and yarn, I traced the issue down to the folder
node_modules/@ngtools/webpack/node_modules
. It does not exist on npm install, but yarn creates it with loader-utils (version 1.1.0) and typescript (version 2.2.2).Deleting this folder fixes the "AppModule is not an NgModule" error and the project can be compiled successfully.
Please note: The typescript version in that folder is 2.2.2. The instructions at Updating to 4.0.0 suggest to use typescript@latest, which results in ^2.3.3 in package.json
Versions.
@angular/compiler-cli: 4.1.3
The log given by the failure.
Mention any other details that might be useful.
package.json.txt
The text was updated successfully, but these errors were encountered: