druxt / druxt.js

The Fully Decoupled Drupal Framework
MIT License
113 stars 21 forks source link

ERROR Cannot read properties of undefined (reading 'src') #442

Closed adicacan closed 2 years ago

adicacan commented 2 years ago

Hi All,

I'm getting following error on npm run dev with druxt-site, version >= 0.10.0. ERROR Cannot read properties of undefined (reading 'src')

If I manually downgrade druxt-site to 0.9.0 everything works fine. It is a minimal config with only "druxt-site" module enabled.

image

Environment

A big Thank You for your efforts in this amazing project!

Decipher commented 2 years ago

Hi @adicacan,

Thanks for the kind words, and thank you for the bug report, I'll investigate today and see if I am able to determine the cause of the issue and resolve.

Decipher commented 2 years ago

@adicacan,

I've tried a few different installs, including a "minimal" installation profile for the Drupal backend, but I haven't been able to reproduce the issue.

Are you able to provide me with more information? A copy of the frontend repository would be extremely helpful, especially if it's only a test site. Otherwise, another frontend repo that is able to reproduce the issue would be equally useful.

It's possible that the issue could be resulting from the backend configuration. The easiest way to determine if that is the case is to point your frontend at another backend; baseUrl: 'https://demo-api.druxtjs.org'

Decipher commented 2 years ago

Hi @adicacan,

I think I found the offending line: https://github.com/druxt/druxt.js/blob/develop/packages/druxt/src/nuxt/index.js#L93

That code specifically handles the re-ordering the Nuxt plugins to ensure the $druxt plugin is available first, and was introduced in 0.16.0: https://druxtjs.org/api/packages/druxt/CHANGELOG#0160

The thing I'm missing is how and why the error is occurring.

Do you have any other Nuxt modules installed, contributed or custom, that provide plugins? Or do you have any custom plugins?

If possible, could you provide a copy of your nuxt.config.js or a sandbox git repository with the issue, so I can investigate further?

adicacan commented 2 years ago

Hi @Decipher,

Thanks for your response.

It is a clean install, no additional modules or plugins. Find the attached both config and package.json. Please let me know if you need anything else.

config.zip

Decipher commented 2 years ago

Hi @adicacan,

I've spent a bit of time on this issue today, and have managed to reproduce it.

The issue is currently limited to Windows, but I haven't determined the cause of the issue.

I also tested using the https://github.com/druxt/demo.druxtjs.org source, which didn't result in that error, although it resulted in another similar error.

I haven't yet tested with WSL2, which would be my preferred development approach when using Windows. I'll try to do so soon.

I'll update once I have more details.

Decipher commented 2 years ago

Hi @adicacan,

Sorry for the long delay, but I had a chance to debug on a windows machine, and have determined the cause of the issue (/ vs \ in paths) and a solution (path.normalize()).

Expect a fix in the upcoming 0.19.3 release.