I have just tried to create new Aurelia 2 app with npx makes aurelia, choosing:
Default TypeScript Aurelia 2 App
After running:
npm install
npm start
Aurelia 2 application brakes in the browser with following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')
at aurelia.js?v=d61b605d:16628:14
at onResolve (aurelia.js?v=d61b605d:433:10)
at new AppRoot (aurelia.js?v=d61b605d:16626:28)
at _Aurelia.app (aurelia.js?v=d61b605d:16754:17)
at _Aurelia.app (aurelia.js?v=d61b605d:20435:18)
at _Aurelia.app (aurelia.js?v=d61b605d:20415:27)
at main.ts:5:4
I tried to Windows 11 and on latest Chrome browser (138). Node v22.17.0 (LTS) and npm v11.4.2.
Altough, I don’t see how this can be connected to OS, because it seems that build finishes without any error.
The error I posted is from browser, when I open the main url. I get only a completely blank page and error in browser’s console.
Update I tried on Windows 10 machine (same version of Chrome, Node and npm) and the project starts in browser (“Hello World” stripe on top). So it is broken on Windows 11. Interesting.
@dwaynecharrington Was there any progress on this issue? I have just tried to run:
npx makes aurelia new-project-name --here -s sass,vitest,playwright,app-with-router
…downloading Aurelia 2 RC1, and I am getting exactly the same issue like a year ago:
app-root.ts:103 Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')
at app-root.ts:103:14
at onResolve (functions.ts:433:10)
at new AppRoot (app-root.ts:101:28)
at _Aurelia.app (aurelia.ts:63:17)
at _Aurelia.app (index.ts:50:18)
at main.ts:10:4
Is there any plan to fix this? I am sure this kind of issues, where you get error as soon as you start the app will drive bunch of people away from Aurelia (like it did with v1 at the time).
@dwaynecharrington The culprit on Windows 11 is drive latter missmatch in paths of components. For example: C:\…\my-app.ts vs c:\…\my-app.ts, thus this line produces wrong result:
The workaround would be to add this on top of the file:
Probably after we get the vite 8 support work in, we can do a dev release, I’m not sure yet.
The main difference is that letter d:\ and D:\, this is breaking the plugin. But the core issue is somewhere in Vite itself, as far as I can tell.
Btw, I see that you already made the fix in master. Do I have to wait for new version of npm package published, before I test the fix?
It’s a simple fix, and only for win32 platform, so we kind of ok, at least in my local (but I didn’t have any issues in the first place).
@bigopon No stress for publishing the package. I’ll just make sure I use PowerShell with capital drive letter for the timebeing.
I’ve tested now again, since you mentioned you have no issue on Windows 11. When I start Console app from start menu, it indeed shows capital drive letters. It turned out that small latter creeps in when I start Console (cmd) in a project folder from Total Commander. However, if I do exactly the same on Windows 10, instantiate console with small drive letter in an Aurelia v2 project folder, npm run start works perfectly fine - Vite is happy.
This is clearly an edge case, but I think it’s good that building pipeline is resistant to this issue.