ReferenceError: navigator is not defined
See original GitHub issueBug report
Description / Observed Behavior
When building the app with NextJS in Jenkins, the build fails with the following error message:
ReferenceError: navigator is not defined
at Object.641 (/app/node_modules/swr/dist/index.js:1:11816)
at __webpack_require__ (/app/node_modules/swr/dist/index.js:1:154)
at Object.516 (/app/node_modules/swr/dist/index.js:1:3661)
at __webpack_require__ (/app/node_modules/swr/dist/index.js:1:154)
at Object.325 (/app/node_modules/swr/dist/index.js:1:1394)
at __webpack_require__ (/app/node_modules/swr/dist/index.js:1:154)
at startup (/app/node_modules/swr/dist/index.js:1:291)
at module.exports.202 (/app/node_modules/swr/dist/index.js:1:323)
at Object.<anonymous> (/app/node_modules/swr/dist/index.js:1:333)
at Module._compile (internal/modules/cjs/loader.js:959:30) {
Expected Behavior
The build should succeed
Repro Steps / Code Example
Or share your code snippet or a CodeSandbox link is also appreciated!
Additional Context
NextJS 9.1.5 SWR 0.2.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
node.js - ReferenceError: navigator is not defined
Does this answer your question? require(processing-js) throws Reference Error: Navigator not Found. – tbking. Feb 25, 2020 at 16:36 · 2. What are ......
Read more >Navigator is not defined----bug - Theia Community
navigator is a browser API. If you require code in the backend that ends up executing browser scripts you will get errors.
Read more >navigator is not defined node js - You.com | The AI Search ...
If you're doing server side rendering then you need to call navigator in a function that is run on the client side. For...
Read more >Error during timezone guessing [ReferenceError: navigator is ...
Check Error Console Actual Results: Error: Skipping Operating System timezone '(null)'. ReferenceError: navigator is not defined Source File: file:///[.
Read more >Getting "ReferenceError: navigator is not defined" in Next.js app
Getting error - ReferenceError: navigator is not defined error from Plasmic in development and production for our NextJS app 3:18:27 PM: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lildata currently swr can only works very smoothly in browser runtime only (the time when I wrote this reply). the short unofficial work around could be:
making swr become more flexible for different runtime is still in progress 😃
hmmm I don’t know. My jest tests ran just fine with react-native 0.63.3 and now started to fail with 0.66.3. My
swr
remained at version0.4.2
. All of the sudden all swr related tests fail.