Nx: Could not find module "@ngrx/schematics"

Created on 15 Jun 2018  ·  6Comments  ·  Source: nrwl/nx

cannot create a new workspace with essential global NPM packages installed.

Env

$ npm list -g --depth=0

/usr/local/lib
├── @angular/[email protected]
├── @nestjs/[email protected]
├── @nrwl/[email protected]
└── [email protected]

ng new myworkspacename --collection=@nrwl/schematics

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

Most helpful comment

This is pretty sad when you go through "Getting started" and got error, don't you think ?

I think README should be updated with create-nx-workspace way until bug fixed.

All 6 comments

This is due to this issue here: https://github.com/angular/angular-cli/issues/11026

  • Saving you the click: It actually seems to be an issue with one of their dependencies.

In the meantime, there are 2 workarounds

Workaround 1

Install @ngrx/schematics as well.

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

Workaround 2

Use create-nx-workspace

sudo npm i @nrwl/schematics -g
create-nx-workspace workspace

We are not really recommending this as the primary method to create a workspace because ng new should work.

I think it is time for nx to make ngrx optional

This is pretty sad when you go through "Getting started" and got error, don't you think ?

I think README should be updated with create-nx-workspace way until bug fixed.

Yep, just wanted to get going using Nx Guide. Does not work :/ Thankfully I found this issue ...

Hi,
The _Getting started_ with Nx has been updated and is accessible via nrwl.io/nx/guide-getting-started.

The create-nx-workspace is now the default way of creating new Nx projects.

Solution for me was:
npm i @ngrx/schematics -D
installing it globally does not have any effect.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vimalraj-a picture vimalraj-a  ·  3Comments

MichaelWarneke picture MichaelWarneke  ·  3Comments

IonFoXx picture IonFoXx  ·  3Comments

Koslun picture Koslun  ·  3Comments

Svancara picture Svancara  ·  3Comments