Closed
Description
I have a Schematics library that I package locally with npm pack
. Then I create a new Angular app, install my schematic and run it.
ng new angular-app --routing --style css
cd angular-app
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --clientId=$clientId
ng test --watch=false && ng e2e
With v0.900.3 of Schematics CLI, the schematics
command errors with:
+ @oktadev/schematics@1.2.1
added 22 packages from 15 contributors and audited 16701 packages in 8.069s
33 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Error: Cannot find module '@oktadev/schematics/package.json'
Require stack:
- /usr/local/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js
- /usr/local/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/tools/workflow/node-workflow.js
- /usr/local/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/tools/index.js
- /usr/local/lib/node_modules/@angular-devkit/schematics-cli/bin/schematics.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.resolve (internal/modules/cjs/helpers.js:80:19)
With @angular-devkit/schematics-cli@0.803.25
, it works fine.
+ @oktadev/schematics@1.2.1
added 22 packages from 15 contributors and audited 16701 packages in 7.991s
33 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
✅️ Added '@okta/okta-angular v1.4.0' into dependencies
🔍 Installing packages...
CREATE /src/app/auth-routing.module.ts (1261 bytes)
CREATE /src/app/home/home.component.html (180 bytes)
CREATE /src/app/home/home.component.spec.ts (964 bytes)
CREATE /src/app/home/home.component.ts (630 bytes)
CREATE /src/app/home/home.component.css (0 bytes)
CREATE /src/app/shared/okta/auth.interceptor.ts (1031 bytes)
UPDATE /src/app/app.module.ts (475 bytes)
UPDATE /package.json (1393 bytes)
UPDATE /src/app/app.component.spec.ts (1344 bytes)
UPDATE /src/app/app.component.ts (603 bytes)
added 13 packages from 13 contributors and audited 16717 packages in 6.525s
Is this a regression?
Yes, the previous version in which this bug was not present was: @angular-devkit/schematics-cli@0.803.25Description
Schematics CLI can't run a schematic.
🔬 Minimal Reproduction
npm i -g @angular-devkit/schematics-cli
git clone https://github.com/oktadeveloper/schematics.git
cd schematics
npm i
./test-app.sh a
You'll see the error. To fix, run:
npm i -g @angular-devkit/schematics-cli@0.803.25
rm -rf apps
./test-app.sh a
This time, there will be no stack trace.
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.3
Node: 12.13.0
OS: darwin x64
Angular: undefined
...
Ivy Workspace: Yes
Package Version
------------------------------------------------------
@angular-devkit/architect 0.900.3 (cli-only)
@angular-devkit/core 9.0.3
@angular-devkit/schematics 9.0.3
@angular/cdk 8.2.3
@schematics/angular 9.0.3
@schematics/update 0.803.21
rxjs 6.5.4
typescript 3.8.2