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.

navigator is not defined

See original GitHub issue

I’m try to make a isomorphic web app running on node server. I use:

import { createView as cv } from 'domvm/dist/full/domvm.full.es'
// .......
    const content = cv(App, { states, update, actions, viewsMap, componentsMap, ssr: true }).html()
// ...........

where content have to be my html text string
All compile well but starting I get:

navigator is not defined

it is executed on first row of domvm function:
function DOMInstr

I’m try to do ssr by get vm.html() and I think on node server window and his child object are not defined, so why domvm is execute DOMInstr function?

Have I do some mistake?

best regards,
Leonardo

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lawrence-dolcommented, May 24, 2021

Do you have DEVMODE settings active. I did a quick search on the code and navigator is only used if DEVMODE.mutations is set true.

Also, this is strange because navigator is only present in the DOMVM dev build; the full package doesn’t have any references at all. That suggests to me that, despite your import, you are somehow using the dev package.

0reactions
lesarcommented, May 25, 2021

Thanks a lot @lawrence-dol and @leeoniya for your interest.
@lawrence-do help me to start my new app using domvm
the app is working
and I’m hunting the caching problem.

bets regards, Leonardo

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - ReferenceError: navigator is not defined
I assume that the problem is that Navigator.geolocation is a Web API and doesn't work on node. Is there a way to mock...
Read more >
ReferenceError: navigator is not defined · Issue #522 · vercel/swr
Bug report Description / Observed Behavior When building the app with NextJS in Jenkins, the build fails with the following error message: ...
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 >
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
Read more >
navigator is not defined react - 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 >

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