Deployment issue with node version in Gatsby starter

20 replies
Last updated: Jan 4, 2023
Hello everyone!, has anybody encountered an error in deployment regarding the node version of your repository? according to my logs, Im using a previous version of node rather than the latest (18.12.1 Lts). With this i cannot deploy. I've checked in my terminal and it returns that iI have the most updated version installed in my desktop. Not sure what to do here. Any help will be much appreciated!
Jan 2, 2023, 5:18 PM
Hello
user E
šŸ‘‹Could you share a bit more about the deployment issue youā€™re experiencing?
Jan 2, 2023, 5:34 PM
Hi
user J
šŸ™‹ā€ā™€ļø, yeah. I am using the sanity + gatsby starter, and at the moment, the web deployment is not going through because it says that Gatsby needs a version of node higher than 18, and it says currently its using 16... But checking on both folders on my terminals and its confirming that im currently using node 18.12.1 ... so not sure whats going on. Thanks so much for your help.
Jan 2, 2023, 10:03 PM
can you show your setup please?
Jan 2, 2023, 10:06 PM
Would that be the package.json?
Jan 2, 2023, 10:18 PM
{

"private": true,

"name": "blog-with-gatsby-web",

"engines": {

"node": ">=18.0.0"

},

"author": "Sanity <<mailto:hello@sanity.io|hello@sanity.io>>",

"scripts": {

"build": "gatsby build",

"clean-cache": "gatsby clean",

"dev": "gatsby develop",

"format": "prettier-eslint --write \"**/*.js\" \"!.cache/**\" \"!node_modules/**\" \"!public/**\"",

"test": "echo \"Write tests! -> <https://gatsby.app/unit-testing>\""

},

"devDependencies": {

"autoprefixer": "^10.4.13",

"dotenv": "^16.0.0",

"gatsby-plugin-postcss": "^5.25.0",

"lint-staged": "^12.3.5",

"postcss": "^8.4.20",

"postcss-preset-env": "^7.3.1",

"prettier": "2.5.1",

"tailwindcss": "^3.2.4"

},

"dependencies": {

"@babel/eslint-parser": "^7.19.1",

"@portabletext/react": "^1.0.1",

"@sanity/image-url": "^1.0.1",

"date-fns": "^2.28.0",

"fix": "^0.0.6",

"gatsby": "^5.3.3",

"gatsby-plugin-image": "^3.3.2",

"gatsby-plugin-manifest": "^5.3.1",

"gatsby-plugin-react-helmet": "^5.6.0",

"gatsby-plugin-sharp": "^5.3.2",

"gatsby-source-filesystem": "^5.3.1",

"gatsby-source-sanity": "^7.3.2",

"gatsby-transformer-sharp": "^5.3.1",

"latest": "^0.2.0",

"npm5": "^5.0.0-beta.69",

"react": "^18.0.0",

"react-dom": "^18.0.0",

"react-helmet": "^6.1.0"

}

}
Jan 2, 2023, 10:18 PM
can you test the version of node by using
node -v
in your terminal, please?
Jan 2, 2023, 10:22 PM
yes i have 18.12.1
Jan 2, 2023, 10:35 PM
You need to show us the error i think, your information is pretty thin at the moment šŸ™‚
Jan 2, 2023, 10:36 PM
And in my deployment it tells me this:
Jan 2, 2023, 10:36 PM
and terminals tells me otherwise
Jan 2, 2023, 10:36 PM
:face_with_peeking_eye:
Jan 2, 2023, 10:37 PM
Well seems like you do not have node installed locally in the project i thinkā€¦ can you check the link please?
Jan 2, 2023, 10:37 PM
yes but you you can have different version of packages installed in projectsā€¦ seems like you do here as well.
go into your project and check there as well i would recommend
šŸ˜‰And then you can follow this instruction (
https://www.gatsbyjs.com/docs/upgrading-node-js/ )
Jan 2, 2023, 10:40 PM
user J
Thanks Saskia, I've checked on both folders and both indicate that the node version installed is 18.12.1. Would updating each package to the latest version solve the issue?
Jan 3, 2023, 1:30 PM
user J
, sorry meant to say dependencies.. :face_with_peeking_eye:
Jan 3, 2023, 1:38 PM
I make EXACTLY the same mistake all the timeā€¦ millivanilly interchanging lib, package, plugin or dependency or nodemodules whenever I am in my zone šŸ˜‰BUT: language is not as strict in real life (even with computers) so, no need to feel weird (and I have studied neurolingustics, so you can trust me
šŸ¤“)
Jan 3, 2023, 2:12 PM
I will look into this later this week, if no-one gets in here earlier.
Jan 3, 2023, 2:13 PM
(as in not today but tomorrow or the day after)
Jan 3, 2023, 2:13 PM
user J
thats cool! Thank you so much!
Jan 3, 2023, 2:19 PM
user J
I was able to solve it! I added a file to the root directory that indicated to Netlify which version of node should run whenever building the websites. Therefore solving the incoherence of node versions on development and building. Thanks for your help as well ! šŸ™‹ā€ā™€ļø
Jan 4, 2023, 11:56 AM

Sanityā€“ build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?