Setting package.json nodejs version gets overwritten

Hi all, hoping someone could point me in the right direction here...

We have a need to manually set the package.json NodeJS version to: ^22.9.0 due to dependancies of certain other packages we are using.

However, every time we then open Wappler it changes the version back to: =>16.9.0

Is there another command I need run or setting in Wappler to keep it set it 22? From my understanding it doesn't have anything to do with the local docker project settings as it's the project packages itself and I can't seem to find any other setting.

Thanks for your help.

Hi Rene,

Have you tried setting it up under Project Options -> Targets - Web. My understanding is that the node environment in a docker deployment is based on the selected node version in each target's Dockerfile.

1 Like

Thanks guptast. Yes however the package.json has nothing to do with a docker deployment nodeJS setting - at least not for anything local. We run a local docker for dev, and then don't use wappler or docker for the production deployment. The package.json is the bit that's important/read for the production deployment.

I have tried this option as I thought it might also affect how Wappler reads the package.json but it doesn't.

Are you saying you changed this option to NodeJS 22 and it didn't make a difference?

image

If it is not docker, then what's the deployment method on the production server. That information will provide a better understanding of the production environment.

Hey @apple yes that's correct. We have one target env setup in the project settings, which is our local docker dev dev that we use to run the app locally.

The project setting doesn't seem to affect the package.json file - we currently have the target env set to version 22. And I guess this behaviour is correct as technically you could have multiple target deployments setup which with different nodeJS versions.

We don't use any of the wappler features to deploy to production. We a use custom build and deployment pipeline in AWS.

The whole purpose of a package.json file is to control which packages (or modules) NodeJS uses for your app. Wappler uses a bunch of different NodeJS packages which are all listed in the package.json file - that's the file that gets edited when you run: npm install

The issue isn't the production environment - that works fine. It's that Wappler seems to overwrite the NodeJS version in package.json. Maybe there's some odd dependancy on v16 - maybe I need to look at this more.

A CI/CD pipeline reads the package.json file to install the correct packages etc to build your server for it to work in production.

we do keep automatically indeed the node engine version to the minimum one that we support.

Will see if we can improve this check for if version is set to greater that it should be left alone.

1 Like

Hi George, what node engine version do you currently support?

I'm using puppeteer who uses chromium who now apparently need node version 18 and have been unable to update the node to this. I wonder if this is by design and the current supported node is 16.19.0? if so how can i get chromium and puppeteer to work?

Many thanks

You can set the Node version in your Target settings @NGM

Hi Cheese,
thanks but my target doesnt show those options

How strange. I don't use Heroku so have never selected it as a Server Type. Maybe this is something that needs to be updated in the Beta to include the same options for Node as other Server Types such as Docker...

If you open your Project directory with 'show hidden files and folders' and then open the project.json file (located in the .wappler directory) this is where those settings are located for us:

  "targets": [
    {
      "name": "Local",
      "remoteURL": "http://localhost:8100",
      "webServerPort": 8100,
      "webServerLang": "node",
      "targetType": "docker",
      "webServer": "node",
      "NodeVersion": "lts",
      "NodeOS": "debian",
      "webLoggingMaxFiles": "5",
      "webLoggingMaxFileSize": "10m",
      "databaseConnectionType": "none",
      "dockerProjectName": "******************************",
      "dockerTimezone": "Europe/Lisbon",
      "NodeImageType": "slim"
    },
    {
      "name": "Remote",
      "remoteURL": "******************************",
      "webServerLang": "node",
      "targetType": "docker",
      "webServer": "node",
      "NodeVersion": "lts",
      "NodeOS": "debian",
      "webLoggingMaxFiles": "5",
      "webLoggingMaxFileSize": "10m",
      "databaseConnectionType": "none",
      "usage": "production",
      "dockerType": "remote",
      "dockerHost": "******************************",
      "dockerProjectName": "******************************",
      "dockerTimezone": "Europe/Lisbon",
      "dockerProtocol": "ssh",
      "dockerServerName": "******************************",
      "NodeImageType": "slim"
    }
  ],

Please BACKUP your Project before making any changes to this file though! Could try and see if altering the Node version within this file resolves your issue...?

Hi Cheese,

I added "NodeVersion": "18" to the production target and sadly when i entered heroku version after the delpoyment it still said node-v16.20.2.

image

Do I need to add other lines like "WebServer" to the project file?

regards

I'm not too sure what you would need to do unfortunately. Was hoping, for your sake, that a simple change would work for you. Might need some input from @George on your above question before moving forwards..

Hi Cheese, many thanks for you spending the time trying to help.

@George - your thoughts/guidance please

1 Like

Currently we list the nodejs version that we minimum support in server connect nodejs installations.

if you really require a different version, you can change the one in our package.json in:

on Windows:
C:\Users\YOUR_USERNAME\AppData\Roaming\Wappler\Configuration\Shared\DMXzone\dmxServerConnect\Includes\NODE

on Mac:
MAC HD/Users/YOUR_USERNAME/Library/Application Support/Wappler/Configuration/Shared/DMXzone/dmxServerConnect/Includes/NODE

But do note that it will be reverted on any NodeJS updates we perform.

We will improve the check in Wappler 7 to not auto change it if set to newer versions.

1 Like

Hi George,
I've just tried what you suggested changing Node to >=18.0
image
but when i run heroku version i still get

Hi @NGM

Normally the Node version that is deployed on your server is configured in the package.json file in the root folder of your project. I would start by changing the NodeJS version in that file first.

I haven't had time to try George's suggestion, but it seems to me that the file he referenced is a settings file for Wappler and controls the internal minimum version of NodeJS that Wappler requires (and therefore auto-sets in the root folder package.json file).

Just a heads up, as per the reason for the ticket - Wappler still overwrites the root project folder package.json NodeJS version whenever you open a Wappler file. So you might need to keep an eye on it. We just git so it's easy to see the change and ignore the file for now.

Hope that helps :slight_smile:

Hi Rene,

Many thanks i read it the same way as you, I will try again but i'm pretty certain that both project.json files (in the root and in the roaming folder) had the same node specification ">=18.0" and yet version returned 16.20.2