Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt does not render page if installed via Yarn or NPM #1925

Open
daniandl opened this issue Aug 27, 2024 · 1 comment
Open

Nuxt does not render page if installed via Yarn or NPM #1925

daniandl opened this issue Aug 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@daniandl
Copy link

Environment

playground

Reproduction

https://stackblitz.com/edit/nuxt-starter-c2dhfc

Describe the bug

When calling a repo from within a setup script in Nuxt 3, the page does not load.
Cannot read properties of undefined (reading '_s') is displayed in a fullscreen error.

Additional context

This has been an issue for a long time in our codebase, as we use Yarn.
Today I decided to create a minimal repro for this, and in the stackblitz you will find the issue.
I have taken the nuxt 3 playground code from this repo and just updated Nuxt/Pinia/Pinia ORM to their latest and purposefully left out any lockfiles.

Now make sure you remove node_modules between each run, then either npm install or yarn install.
Now run yarn run build or npm run build and then run the node server with node .output/server/index.mjs
You will notice the error in both cases.

Now, if you run it with pnpm install --> pnpm build, the app works fine.
Again, make sure to clear node_modules and delete any lockfiles each time.

Would love some insight here, as this is extremely frustrating and confusing behavior, that the package manager can play a role in whether our code works in production or not. (Dev mode works for all pkg managers)

Logs

...
[nuxt-app] app:created: 0.073ms
[nuxt-app] vue:setup: 0.002ms
Error: TypeError: Cannot read properties of undefined (reading '_s')
    at useStore (/Users/username/projects/testing/nuxt-app/.output/server/node_modules/pinia/dist/pinia.prod.cjs:572:20)
    at Query.commit (file:///Users/username/projects/testing/nuxt-app/.output/server/node_modules/pinia-orm/dist/index.mjs:801:90)
    at Query.saveElements (file:///Users/username/projects/testing/nuxt-app/.output/server/node_modules/pinia-orm/dist/index.mjs:1349:30)
    at Query.save (file:///Users/username/projects/testing/nuxt-app/.output/server/node_modules/pinia-orm/dist/index.mjs:1340:13)
    at Proxy.save (file:///Users/username/projects/testing/nuxt-app/.output/server/node_modules/pinia-orm/dist/index.mjs:1937:25)
    at setup (file:///Users/username/projects/testing/nuxt-app/.output/server/chunks/build/server.mjs:1022:28)
    at _sfc_main$2.setup (file:///Users/username/projects/testing/nuxt-app/.output/server/chunks/build/server.mjs:1049:25)
    at callWithErrorHandling (/Users/username/projects/testing/nuxt-app/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:85:19)
    at setupStatefulComponent (/Users/username/projects/testing/nuxt-app/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:6122:25)
    at setupComponent (/Users/username/projects/testing/nuxt-app/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:6109:36)
Info: https://vuejs.org/error-reference/#runtime-0
[nuxt-app] vue:error: 0.35ms
[nuxt-app] app:rendered: 0.002ms
...
@CodeDredd CodeDredd added bug Something isn't working and removed pending triage labels Sep 14, 2024
@CodeDredd
Copy link
Owner

Ufff waht a bug....trying to look into it tomorrow. That's really odd...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants