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

[BUG] Node 21 now has a "navigator" object defined on global scope. #2376

Closed
nicksrandall opened this issue Oct 20, 2023 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@nicksrandall
Copy link

This line no longer works in Node v21 because "navigator" is not on the global scope but it does not have an userAgent property.
There may be other issues but this is the first one I encountered when upgrading to node 21.

https://github.com/framer/motion/blob/main/packages/framer-motion/src/projection/node/create-projection-node.ts#L2100

@nicksrandall nicksrandall added the bug Something isn't working label Oct 20, 2023
@meabed
Copy link

meabed commented Oct 23, 2023

Yes the issue happens on node 21:

when access navigation is not defined.

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

@AaronSTAY
Copy link

Causing me build errors even with all Framer Motion components removed from my client side code

@AaronSTAY
Copy link

Resolved manually setting Node version

@rmill2016
Copy link

Resolved manually setting Node version

I tried setting .nvmrc to my node version as well as adding engines property to package.json, this wasn't able to resolve it for me. What did you do?

@AaronSTAY
Copy link

Locally, you can switch your Node version using NVM

For issues in CI/CD, I had to expressly set the node version in my runner and builder inside my Dockerfile

@rmill2016
Copy link

Alright, I just did this via nvm install 21.1.0 and nvm use 21.1.0. This doesn't seem to have fixed the issue, I'll probably just wait until the PR gets merged.

@AaronSTAY
Copy link

You will need to go down to a version below 21 to get it working.

@meabed
Copy link

meabed commented Oct 25, 2023

this has been fixed in latest release https://github.com/nodejs/node/releases/tag/v21.1.0

[5a52c518ef] - (SEMVER-MINOR) lib: add navigator.userAgent (Yagiz Nizipli) nodejs/node#50200

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

5 participants