Node Version Error, unable to get permissions to update

Node is stopping my server from running based on version. However, I cannot update:

I also attempted installing it locally (npm install n) and successfully installed the n package, but was unable to update due to not being able to use the sudo command. image

The error is only triggered when I require a new npm package that requires node 14.

You should add packages via the Add Package button on the package.json file

1 Like

Hi, you can update your version in your package.json, however, I made a simple script to do so for you.

const fs = require('fs'); 
var pkgdotjson = JSON.parse(fs.readFileSync("./package.json"), "utf8")
if (!pkgdotjson.engines){
 pkgdotjson.engines = {}
}
pkgdotjson.engines.node = "14.x"
fs.writeFileSync("package.json", JSON.stringify(pkgdotjson))

Yep! And if you’re wondering how to do, that check out the snippet in Can I change the version of node.js my project uses? - Glitch Support

2 Likes