question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read properties of undefined (reading 'modules')

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.14.0
  • Nuxt Version: 3.0.0-rc.9
  • Nitro Version: 0.5.0
  • Package Manager: npm@8.3.1
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  1. npx nuxi init nuxt-app
  2. cd nuxt-app
  3. npm install
  4. npm run dev

Error is thrown only when running on macbook…

Describe the bug

Unable to run dev after fresh install on Macbook. However, doing npm run build, and npm run preview works without issue. Testing in stackblitz shows no issues however.

Additional context

Had no issues yesterday when doing fresh install of rc.9

Logs

gurpinder@Gurpinders-MacBook-Pro bug % npx nuxi init bug-test
Need to install the following packages:
  nuxi
Ok to proceed? (y) 
Nuxi 3.0.0-rc.9                                                                                         22:28:53
β„Ή cloned nuxt/starter#v3 to /Users/gurpinder/Desktop/bug/bug-test                                       22:28:54
                                                                                                        22:28:54
Nuxi 3.0.0-rc.9                                                                                                              22:29:51
Nuxt 3.0.0-rc.9 with Nitro 0.5.0                                                                                             22:29:51
                                                                                                                             22:29:54
  > Local:    http://localhost:3000/ 
  > Network:  http://192.168.0.106:3000/

β„Ή Vite server warmed up in 171ms                                                                                             22:29:55
βœ” Nitro built in 185 ms                                                                                                nitro 22:29:55
β„Ή Vite client warmed up in 701ms                                                                                             22:29:55
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.
[Vue warn]: Unhandled error during execution of setup function 
  at <NuxtRoot>
[nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'modules')
  at _sfc_main.setup (./node_modules/nuxt/dist/app/components/nuxt-root.vue:67:16)  
  at callWithErrorHandling (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:157:22)  
  at setupStatefulComponent (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7107:29)  
  at setupComponent (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7062:11)  
  at renderComponentVNode (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:172:17)  
  at renderToString (./node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:446:26)  
  at Object.renderToString$1 [as renderToString] (./.nuxt/dev/index.mjs:472:24)  
  at Object.renderToString (./node_modules/vue-bundle-renderer/dist/runtime.mjs:173:40)  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ./.nuxt/dev/index.mjs:521:21
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.
[Vue warn]: Unhandled error during execution of setup function 
  at <NuxtRoot>
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.
[Vue warn]: Unhandled error during execution of setup function 
  at <NuxtRoot>

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
danielroecommented, Sep 8, 2022

If it is a vue dependency issue, you could either add that package to your build.transpile or use yarn resolutions or npm overrides to force vue version.

1reaction
BracketJohncommented, Sep 9, 2022

As this is also happening in https://github.com/sidestream-tech/sidebase, I’ve checked for different vue-versions there, and it looks like they are all the same:

❯ npm list --depth=10 | grep ' vue@'
β”‚ └── vue@3.2.38 deduped
β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ └── vue@3.2.38 deduped
β”‚ └── vue@3.2.38 deduped
β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ β”œβ”€β”€ vue@3.2.38 deduped
β”‚ β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ β”‚ └── vue@3.2.38 deduped
β”‚ └── vue@3.2.38 deduped
β”‚ └── vue@3.2.38 deduped
β”œβ”€β”¬ vue@3.2.38
β”‚ β”‚ └── vue@3.2.38 deduped
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - TypeError: Cannot read properties of undefined ...
You are trying to iterate through the args array ( args.forEach() ) before var args exists. If you move var args = Message.content.split("Β ......
Read more >
Uncaught TypeError Cannot read properties of undefined ...
Have you received Uncaught TypeError Cannot read properties of undefined reading Modules JavaScript client error on the page or in the browser console?...
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Uncaught TypeError: Cannot read properties of ... - DataTables
... TypeError: Cannot read properties of undefined (reading 'classes') at ./node_modules/datatables.net-bs4/js/dataTables.bootstrap4.mjsΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found