Codesandbox-client: Ability to specify version of Node in server templates

Created on 15 Jan 2019  路  5Comments  路  Source: codesandbox/codesandbox-client


This issue is a feature for the ability to specify the version of Node used on the server template. Currently, it only uses version 8.14.0 which is missing some important features.


I'm not quite sure. I believe packages.json supports the use of "engines". But some other method would be acceptable too.

Most helpful comment

The link to the documentation has changed it should be https://codesandbox.io/docs/start#can-i-change-the-node-version-used-in-a-container-sandbox

The solution is set the node property in sandbox.config.json

{
  "node": 14
}

All 5 comments

I think this might be supported through dependencies in package.json:

  "dependencies": {
    "node": "11.6.0",
    "npm": "6.5.0"
  },

The sandbox probably wasn't reloaded properly after adding the dependency. Closing.

If anyone is here trying to figure out how to change the version of Node used in the server container feature of codesandbox.io, unfortunately you can't according to this response.

You can't change the node version at this time. (Jan 7, 2020)

The node as a dependency workaround does work though: https://codesandbox.io/docs/faqs#can-i-change-the-node-version-used-in-a-container-sandbox

I've updated my response in the linked thread.

Thanks for the quick reply, and link to the documentation, @garethx. That worked for me.

For the lazy, just do update your package.json to include:

"scripts": {
  "start": "./node_modules/node/node_modules/.bin/node ./src/index.js"
},
"dependencies": {
  "node": "14.3.0"
},

Click the link @garethx shared above to see usage with nodemon.

Now we just need Google to return the docs page above this issue when searching for how to "change node version in codesandbox" :)

The link to the documentation has changed it should be https://codesandbox.io/docs/start#can-i-change-the-node-version-used-in-a-container-sandbox

The solution is set the node property in sandbox.config.json

{
  "node": 14
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

NataliaTepluhina picture NataliaTepluhina  路  3Comments

donavon picture donavon  路  3Comments

wojciechczerniak picture wojciechczerniak  路  3Comments

Haroenv picture Haroenv  路  3Comments

zocky picture zocky  路  3Comments