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.

ReferenceError: Node is not defined

See original GitHub issue

I’m using @vueuse/head v0.6.0 with vite-ssg and was confused with the following error message that killed the build script because it refers to Node (which I thought meant the language but actually refers to a variable called Node in this case).

ReferenceError: Node is not defined
    at /[..]/node_modules/@vueuse/head/dist/index.js:202:55
    at Array.forEach (<anonymous>)

The following code in the built script in dist is the culprit:

  oldElements.forEach((el) => {
    if (el.nextSibling && el.nextSibling.nodeType === Node.TEXT_NODE) {
      el.nextSibling.remove();
    }
    el.remove();
  });

There is no Node.TEXT_NODE imported or defined anywhere so if run this code will fail (although it seems to work fine in the browser at least w/ Vite dev server). This was introduced in #28. My workaround is to use npm version 0.5.1 which works fine, the current 0.6.0 doesn’t.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
praburangkicommented, Sep 23, 2021

So after a few trial and errors i’ve manage it pass the build step. In the index.html I have this line:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

And in the useHead within the meta arrays there is this code:

{ name: 'viewport', content: 'width=device-width, initial-scale=1' },

After I removed it from the array then the build pass.

0reactions
github-actions[bot]commented, Nov 18, 2021

🎉 This issue has been resolved in version 0.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

First time using node.js - "ReferenceError: node is not defined"
Open nodejs: C:\path_of_nodejs>node; Exit from node REPL mode: >process.exit(); You are ready for your node commands: >node -v.
Read more >
node.js reference error node not defined · Issue #414 - GitHub
I just installed node.js on my Windows 10 computer. I tried to see the version by typing 'node -v' at the command prompt...
Read more >
ReferenceError: node is not defined - General
I have copied couple of nodes between two machines running node red. unfortunately this broke node red and removing npm, node js, deleted...
Read more >
ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
ReferenceError : "x" is not defined. The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >
node -v ReferenceError: node is not defined - Metahat
node -v ReferenceError: node is not defined. Trying to make node.js work with command node -v and end up with an error.
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