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.
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
}
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