analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.5k stars 240 forks source link

Cannot find module '@angular-devkit/build-angular/src/builders/browser-esbuild/angular/aot-compilation' #344

Closed abarcenas29 closed 1 year ago

abarcenas29 commented 1 year ago

Please provide the environment you discovered this bug in.

Processor: M1 Installed RAM: 8.0 GB Node.js: 19.8.1 analog: 0.1.9 Angular version chosen: Angular15

Which area/package is the issue in?

create-analog

Description

Can not run a fresh install of Analog in it's latest version.

Please provide the exception or error you saw

failed to load config from /Users/aldrichallenbarcenas/develop/analog-sandbox/vite.config.ts
Error: Cannot find module '@angular-devkit/build-angular/src/builders/browser-esbuild/angular/aot-compilation'
Require stack:
- /Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/lib/compiler-plugin.js
- /Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/lib/angular-vite-plugin.js
- /Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/index.js
- /Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/platform/src/lib/platform-plugin.js
- /Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/platform/src/index.js
- /Users/aldrichallenbarcenas/develop/analog-sandbox/vite.config.ts
- /Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/vite/dist/node/chunks/dep-79892de8.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
    at Module._resolveFilename (/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/tsconfig-paths/lib/register.js:103:40)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/lib/compiler-plugin.js:18:27)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at _require.extensions.<computed> [as .js] (file:///Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/vite/dist/node/chunks/dep-79892de8.js:63989:17)
    at Module.load (node:internal/modules/cjs/loader:1089:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/lib/compiler-plugin.js',
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/lib/angular-vite-plugin.js',
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/vite-plugin-angular/src/index.js',
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/platform/src/lib/platform-plugin.js',
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/@analogjs/platform/src/index.js',
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/vite.config.ts',
    '/Users/aldrichallenbarcenas/develop/analog-sandbox/node_modules/vite/dist/node/chunks/dep-79892de8.js'
  ]
}

Other information

N/A

I would be willing to submit a PR to fix this issue

brandonroberts commented 1 year ago

This has been fixed on the main branch, but you can fix locally by install @analogjs/vite-plugin-angular@0.2.0-alpha.22 in the package.json. A release will go out on Monday to fix new installs

Temirlan-Kudabayev commented 1 year ago

This has been fixed on the main branch, but you can fix locally by install @analogjs/vite-plugin-angular@0.2.0-alpha.22 in the package.json. A release will go out on Monday to fix new installs

Good afternoon, thanks for your answer, but i still have this error occured as @abarcenas29 described:

"@analogjs/content": "^0.2.0-beta.2",
"@analogjs/router": "^0.2.0-beta.2"
goetzrobin commented 1 year ago

This has been fixed on the main branch, but you can fix locally by install @analogjs/vite-plugin-angular@0.2.0-alpha.22 in the package.json. A release will go out on Monday to fix new installs

Good afternoon, thanks for your answer, but i still have this error occured as @abarcenas29 described:


"@analogjs/content": "^0.2.0-beta.2",

"@analogjs/router": "^0.2.0-beta.2"

Have you also updated your @analogjs/platform to the same version? This issue has occurred for me with npm resolving the latest version of the platform packages dependencies. The newest version of the platform package pins the version number and that fixed the issue for me

brandonroberts commented 1 year ago

Because you're on Angular v15, you should match up with the versions here.

https://github.com/analogjs/analog/blob/main/packages/create-analog/template-angular-v15/package.json#L37

Temirlan-Kudabayev commented 1 year ago

thank you all @goetzrobin @brandonroberts ❤️ , my problem solved

KlausEverWalkingDev commented 1 year ago

@brandonroberts sorry to disturb you but could have a reason for having this error even using the packages' versions of that package.json? Worth noting that even in that file the versions are not matching.

brandonroberts commented 1 year ago

@brandonroberts sorry to disturb you but could have a reason for having this error even using the packages' versions of that package.json? Worth noting that even in that file the versions are not matching.

Sure. There was a change in a dependency we use that changed where the file was located. It's fixed in the 0.2.0 beta versions to reference the new file location. This version works with Angular v16.

We pin the package.json version in the templates for Angular v15, but Yarn installs both versions which causes the error.

This could be fixed for Angular v15 by publishing another version of the @analogjs/platform package that pins to the v15 version of the Vite plugin. I'll look into this soon.

Hope this helps with the confusion and error.

t-mish commented 1 year ago

The same error is shown when you start a new project with analog using pnpm

I listed my configuration here #361

brandonroberts commented 1 year ago

The issue with the Angular v15 template has been resolved in the latest release of create-analog. Choosing angular-v15 will install the correct versions and fixes the missing aot-compilation error.