angular-cli: ng update fails with "Cannot find module '@angular-devkit/schematics'"
π Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Description
Hi there, after reading a tweet from Igor to test out the new RC of ng9 I tried it on our application. The update command is not able to be finished even with flag --force
due to the log below.
π₯ Exception or Error
ng update @angular/core @angular/cli --next --force
The installed Angular CLI version is older than the latest pre-release version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 74 dependencies.
Fetching dependency metadata from registry...
Package "@angular/core" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/compiler-cli" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/compiler" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/common" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/animations" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/forms" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/router" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/platform-browser-dynamic" has a missing peer dependency of "tslib" @ "^1.10.0".
Package "@angular/service-worker" has a missing peer dependency of "tslib" @ "^1.10.0".
Updating package.json with dependency @angular/cli @ "9.0.0-rc.5" (was "8.3.20")...
Updating package.json with dependency @angular/core @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/compiler-cli @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/language-service @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular-devkit/build-angular @ "0.900.0-rc.5" (was "0.803.20")...
Updating package.json with dependency @angular/compiler @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/common @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/animations @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/platform-browser @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/forms @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/router @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency @angular/service-worker @ "9.0.0-rc.5" (was "8.2.14")...
Updating package.json with dependency typescript @ "3.6.4" (was "3.5.3")...
UPDATE package.json (5246 bytes)
β Packages installed successfully.
** Executing migrations of package '@angular/cli' **
β― Angular Workspace migration.
Update an Angular CLI workspace to version 9.
UPDATE angular.json (8832 bytes)
UPDATE ngsw-config.json (1508 bytes)
UPDATE src/tsconfig.app.json (380 bytes)
UPDATE package.json (5243 bytes)
β Packages installed successfully.
Migration completed.
β― Lazy loading syntax migration.
Update lazy loading syntax to use dynamic imports.
Migration completed.
An unhandled exception occurred: Cannot find module '@angular-devkit/schematics'
Require stack:
- /Users/konradcerny/Sites/Erento/frontend-som/node_modules/@angular/core/schematics/migrations/move-document/index.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/index.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/utilities/json-schema.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/models/command-runner.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/lib/cli/index.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/lib/init.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/bin/ng
See "/private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/ng-PMjFIi/angular-errors.log" for further details.
The angular-errors.log
file content:
[error] Error: Cannot find module '@angular-devkit/schematics'
Require stack:
- /Users/konradcerny/Sites/Erento/frontend-som/node_modules/@angular/core/schematics/migrations/move-document/index.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/index.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/utilities/json-schema.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/models/command-runner.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/lib/cli/index.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/lib/init.js
- /private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular/cli/bin/ng
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at /Users/konradcerny/Sites/Erento/frontend-som/node_modules/@angular/core/schematics/migrations/move-document/index.js:19:26
at /Users/konradcerny/Sites/Erento/frontend-som/node_modules/@angular/core/schematics/migrations/move-document/index.js:10:17
at Object.<anonymous> (/Users/konradcerny/Sites/Erento/frontend-som/node_modules/@angular/core/schematics/migrations/move-document/index.js:16:3)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at new ExportStringRef (/private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/export-ref.js:18:25)
at NodeModulesEngineHost._resolveReferenceString (/private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:58:21)
at NodeModulesEngineHost.createSchematicDescription (/private/var/folders/zl/ltj48w2n2hgcptmp_fh69mkm0000gn/T/.ng-temp-packages-qjhg0F/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:173:34)
π Your Environment
Angular CLI: 8.3.20
Node: 12.12.0
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.20
@angular-devkit/build-angular 0.803.20
@angular-devkit/build-optimizer 0.803.20
@angular-devkit/build-webpack 0.803.20
@angular-devkit/core 8.3.20
@angular-devkit/schematics 8.3.20
@angular/cli 8.3.20
@angular/pwa 0.803.20
@ngtools/webpack 8.3.20
@schematics/angular 8.3.20
@schematics/update 0.803.20
rxjs 6.5.3
typescript 3.5.3
webpack 4.39.2
I will try to be as helpful as possible, but no clue what more data I could provide atm.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 22 (3 by maintainers)
Commits related to this issue
- fix(@angular/cli): inform user and error if schematics package is in unreachable location This is a workaround for the schematics runtime to support the requirement of packages containing migrations ... — committed to clydin/angular-cli by clydin 5 years ago
- fix(@angular/cli): inform user and error if schematics package is in unreachable location (#16466) This is a workaround for the schematics runtime to support the requirement of packages containing mi... — committed to angular/angular-cli by clydin 5 years ago
- fix(@angular/cli): inform user and error if schematics package is in unreachable location (#16466) This is a workaround for the schematics runtime to support the requirement of packages containing mi... — committed to angular/angular-cli by clydin 5 years ago
- fix(@angular/cli): inform user and error if schematics package is in unreachable location (#16466) This is a workaround for the schematics runtime to support the requirement of packages containing mi... — committed to angular/angular-cli by alan-agius4 5 years ago
- fix(@angular/cli): inform user and error if schematics package is in unreachable location (#16466) This is a workaround for the schematics runtime to support the requirement of packages containing mi... — committed to angular/angular-cli by alan-agius4 5 years ago
Same issue with @angular/material
Fixed by
npm i @schematics/angular
before update@clydin , I tried this advice:
But still get the error.
https://stackoverflow.com/a/58111309 I tried just:
npm i @angular-devkit/schematics
Reset again, installed core too:
npm i @angular-devkit/core
Update succeeds, with commentary on these packages:
@blogcraft Have a look here at the commit to address this
https://github.com/clydin/angular-cli/commit/5d6602161b3151da7330c3854c9c7cce4c291f12
Effectively temporarily installing β@angular-devkit/schematicsβ yourself prior to the migrations, then uninstall it after should work
@clydin @alan-agius4 Iβm getting this issue updating from Angular 8.2.14 to 9.0 (angular/cli 8.3.25 to 9.0.1)
Should this issue be re-opened, or should I file a new issue? I can provide more details if needed. My projectβs fairly simple, I created it with angular/cli@8.2, the only additional dependencies are @angular/material and luxon
$ ng update @angular/cli @angular/core
/tmp/ng-681DTk/angular-errors.log
Reset my project to show state before:
git reset --hard; rm node_modules; npm i
ng version
$ npm ls @angular-devkit/schematics
in our case, unfortunately, only the following files have been changed:
and I believe there should be also other files modified in regards to ivy & other changes in v9