ReferenceError: Node is not defined
See original GitHub issueI’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:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
So after a few trial and errors i’ve manage it pass the build step. In the
index.html
I have this line:And in the
useHead
within themeta
arrays there is this code:After I removed it from the array then the build pass.
🎉 This issue has been resolved in version 0.7.2 🎉
The release is available on:
Your semantic-release bot 📦🚀