ngxs / store

๐Ÿš€ NGXS - State Management for Angular
http://ngxs.io
MIT License
3.52k stars 400 forks source link

๐Ÿž[BUG]: Fresh Angular 18 project and NGXS docs / Cannot find module standalone.js #2183

Closed mhp-borisbojic closed 2 weeks ago

mhp-borisbojic commented 2 weeks ago

Affected Package

@ngxs/store

Description

Following the documentation (installation) leads to an error message

๐Ÿ”ฌ Minimal Reproduction

  1. Create a fresh Angular 18 project: ng new ng18test with all default configuration / settings, no SSR
  2. Switch to directory cd ng18test
  3. Add @ngxs/store by docs: ng add @ngxs/store

๐Ÿ”ฅ Exception or Error

Adding @ngxs/store leads to:


โ„น Using package manager: npm
โœ” Found compatible package version: @ngxs/store@18.0.0.
โœ” Package information loaded.

The package @ngxs/store@18.0.0 will be installed and executed.
Would you like to proceed? Yes
โœ” Packages successfully installed.
Cannot find module '/Users/borisbojic/Development/ng18test/node_modules/@schematics/angular/private/standalone.js'

Environment


Libs:
- @angular/core version: ^18.0.0
- @ngxs/store version: ^18.0.0

For Tooling issues:
- node.js 20.15.0
- macOS 14.5            
msmallest commented 2 weeks ago

Same issue as well when trying to use a schematic for initializing a store in a project

mhp-borisbojic commented 2 weeks ago

Sadly, it only fixed the error message, but it still doesn't work as expected - I've deleted node_modules and yarn.lock as well:

โฏ ng add @ngxs/store
โ„น Using package manager: yarn
โœ” Found compatible package version: @ngxs/store@18.0.0.
โœ” Package information loaded.

The package @ngxs/store@18.0.0 will be installed and executed.
Would you like to proceed? Yes
โœ” Packages successfully installed.
Collection "@ngxs/store" cannot be resolved.
โฏ yarn
โžค YN0000: ยท Yarn 4.3.1
โžค YN0000: โ”Œ Resolution step
โžค YN0000: โ”” Completed
โžค YN0000: โ”Œ Fetch step
โžค YN0000: โ”” Completed in 0s 251ms
โžค YN0000: โ”Œ Link step
โžค YN0000: โ”‚ ESM support for PnP uses the experimental loader API and is therefore experimental
โžค YN0000: โ”” Completed
โžค YN0000: ยท Done with warnings in 0s 433ms
โฏ ng generate @ngxs/store:starter-kit
An unhandled exception occurred: Collection "@ngxs/store" cannot be resolved.
See "/private/var/folders/jd/5j65z2j12ql0c1bkp5jlz3qc0000gp/T/ng-ma6wHT/angular-errors.log" for further details.

The content of the log:

[error] Error: Collection "@ngxs/store" cannot be resolved.
    at SchematicEngineHost.resolve (/opt/homebrew/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:86:19)
    at SchematicEngineHost._resolveCollectionPath (/opt/homebrew/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:91:37)
    at SchematicEngineHost.createCollectionDescription (/opt/homebrew/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:116:27)
    at SchematicEngine._createCollectionDescription (/opt/homebrew/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:167:40)
    at SchematicEngine.createCollection (/opt/homebrew/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/src/engine/engine.js:160:43)
    at GenerateCommandModule.getSchematics (/opt/homebrew/lib/node_modules/@angular/cli/src/commands/generate/cli.js:137:48)
    at async GenerateCommandModule.getSchematicsToRegister (/opt/homebrew/lib/node_modules/@angular/cli/src/commands/generate/cli.js:177:76)
    at async GenerateCommandModule.builder (/opt/homebrew/lib/node_modules/@angular/cli/src/commands/generate/cli.js:33:55)
    at async runCommand (/opt/homebrew/lib/node_modules/@angular/cli/src/command-builder/command-runner.js:76:5)
    at async default_1 (/opt/homebrew/lib/node_modules/@angular/cli/lib/cli/index.js:70:16)
markwhitfeld commented 2 weeks ago

@mhp-borisbojic The fix has been merged, but not released yet. It will be released soon. If you want to try out the unreleased version you can use the @ngxs/store@dev package.