Skip to content

TypeError: Cannot read properties of undefined (reading 'toLowerCase') #57183

New issue

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

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

Already on GitHub? # to your account

Closed
1 task done
2giosangmitom opened this issue Oct 21, 2023 · 10 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template. locked

Comments

@2giosangmitom
Copy link

2giosangmitom commented Oct 21, 2023

Link to the code that reproduces this issue

https://github.com/2giosangmitom/blog

To Reproduce

Run npm run build

Current vs. Expected behavior

Node 21:
image

Node 18:
image

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun, 15 Oct 2023 18:38:43 +0000
Binaries:
  Node: 21.0.0
  npm: 10.2.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 13.5.6
  eslint-config-next: 13.5.6
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: export

Which area(s) are affected? (Select all that apply)

App Router, Turbopack (--turbo), TypeScript (plugin, built-in types)

Additional context

Seems like it only crashes when using Node 21, I tested with Node 18 and it works.

@2giosangmitom 2giosangmitom added the bug Issue was opened via the bug report template. label Oct 21, 2023
@github-actions github-actions bot added Turbopack Related to Turbopack with Next.js. TypeScript Related to types with Next.js. labels Oct 21, 2023
@huozhi huozhi removed Turbopack Related to Turbopack with Next.js. TypeScript Related to types with Next.js. labels Oct 23, 2023
@veenu840
Copy link

I'm facing this issue after running npm run export in a next.js project. We are using Framer Motion for animation
Version of the Framer-motion and Next.js
"framer-motion": "^10.16.4",
"next": "^13.5.6",

TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at userAgentContains (file:///builds/project/projectName/node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs:1470:25)
at file:///builds/project/projectName/node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs:1476:20
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:430:15)

Build error occurred
Error: Failed to collect page data for /
at /builds/finbook/finbookcms/node_modules/next/dist/build/utils.js:1171:15 {
type: 'Error'
}

@aphrysof
Copy link

Hi @veenu840 having the same issue, have you been able to solve it?

@veenu840
Copy link

Hi @aphrysof , No it's still not resolved.

@alextracy
Copy link

I ran into a similar issue when I upgraded node to 21 from 20.8.1.

@aphrysof
Copy link

I had to downgrade my node version back to 18 and it worked!

@algusaem
Copy link

It's very funny because in our case, the CI/CD that we have didn't go past the error but whenever I tried to go into the Docker container and run it manually it ran without a single issue :')

We ended up fixing it by going back to another node version (19.9.0), hope this gets fixed soon!

@YukiKitagata
Copy link

YukiKitagata commented Oct 31, 2023

This issue may be related to the addition of the navigator object in Node.js v21.

nodejs/node#50412

CleanShot 2023-10-31 at 14 59 02@2x

@jacobgawel
Copy link

I'm still experiencing issues with this

image

@FilFarEu
Copy link

FilFarEu commented Nov 6, 2023

With framer-motion I also have the same issue:
Cannot read properties of undefined (reading 'toLowerCase')

my setup:
"dependencies": {
"@formatjs/intl-localematcher": "^0.4.2",
"@headlessui/react": "^1.7.17",
"axios": "^0.21.1",
"bootstrap": "^5.3.2",
"framer-motion": "^10.16.4",
"negotiator": "^0.6.3",
"next": "13.5.4",
"next-intl": "^3.0.0-beta.19",
"react": "^18",
"react-countup": "^6.4.2",
"react-dom": "^18",
"react-icons": "^4.11.0",
"react-parallax": "^3.5.1",
"swiper": "^11.0.3",
"swr": "^1.0.0"
},

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

9 participants