Skip to content

ng new does not resolve dependencies of specified collection #11026

@FrozenPandaz

Description

@FrozenPandaz

Versions

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.0.5
Node: 8.11.1
OS: linux x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.5
@angular-devkit/core         0.6.5
@angular-devkit/schematics   0.6.5
@schematics/angular          0.6.5
@schematics/update           0.6.5
rxjs                         6.2.0
typescript                   2.7.2

Repro steps

npm i @nrwl/schematics -g
ng new workspace --collection @nrwl/schematics

Observed behavior

Throws an error

Could not find module "@ngrx/schematics" from "/home/jason/projects/work/temp/temp".
Error: Could not find module "@ngrx/schematics" from "/home/jason/projects/work/temp/temp".
    at Object.resolve (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/core/node/resolve.js:141:11)
    at NodeModulesEngineHost._resolvePackageJson (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:29:21)
    at NodeModulesEngineHost._resolveCollectionPath (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:70:40)
    at NodeModulesEngineHost.createCollectionDescription (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:106:27)
    at SchematicEngine._createCollectionDescription (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:78:40)
    at SchematicEngine._createCollectionDescription (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:89:48)
    at SchematicEngine.createCollection (/usr/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:71:43)
    at Object.getCollection (/usr/lib/node_modules/@angular/cli/utilities/schematics.js:28:31)
    at NewCommand.getOptions (/usr/lib/node_modules/@angular/cli/models/schematic-command.js:193:41)
    at NewCommand.initialize (/usr/lib/node_modules/@angular/cli/commands/new.js:48:21)

Desired behavior

We have a dependency on @ngrx/schematics. ng new should be able to resolve it from globalNodeModules/@nrwl/schematics/node_modules/@ngrx/schematics

jason@Jason-PC-U:~/projects/work/temp/nx6workspace$ npm ls @ngrx/schematics -g
/usr/lib
└─┬ @nrwl/schematics@6.0.2
  └── @ngrx/schematics@5.2.0 

Mention any other details that might be useful (optional)

Workaround

The workaround for users is to also manually install the dependency globally

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions