0

We have a react app that uses 14.x.x version. Now we would like to upgrade the node version to 19.x.x. Can you please guide the steps to do that?

In package.json it is mentioned as

engines: {
    "node": ">=14.15.1"
}
1
  • 1
    well basically engines section is just advisory and not connected to react. React uses the installed version when you run npm run Commented Sep 29, 2023 at 13:03

4 Answers 4

3

its npm update is the command to update all dependencies in the project but first check the outdated packages and comparisons using npm outdated command. it will nicely list the current, outdated and required package list. enter image description here check the list and update as per your project code. Be careful about breaking changes.

More info: https://docs.npmjs.com/updating-packages-downloaded-from-the-registry

Sign up to request clarification or add additional context in comments.

Comments

0

Using NPM:To update Node using NPM do the following: 1.Open the Terminal and check your current Node version:  node -v  Install n package using the following command: npm install -g n   

This command will install a tool called "n" which you can use to update Node easily.

2.To update Node, run the following command in your terminal:            n latest This command will install the latest version of Node on your system.Now you can

3.verify that your update is complete by rechecking your Node version:   node -v.

You can also manually download and install the latest Node version from the official website. https://nodejs.org/en/download/current

2 Comments

This gives me steps to upgrade node in my machine. But how to make react to use that node version.
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

you can run the command npm update or npm update --save or npm update --save-dev, depending on your needs

Comments

-2

For a greater version jump I actually recommend creating a new project and then pasting your source and configuration there.

For usage with Yoeman and Node 22:

  1. Install the new node version, e.g. with Node Version Manager (nvm):

    1. nvm install 22.20.1 # Will be supported until 2027

    2. nvm use 22

  2. Install the required global packages for the new node version:

    1. npm install -g gulp-cli yo @microsoft/generator-sharepoint @pnp/cli-microsoft365
  3. Execute yoeman in a new folder with your solution name to create your new solution

    1. yo

      1. SharePoint

      2. Webpart

      3. React (or the one you need)

      4. Original project name

  4. Install packages

    1. npm install <your additionally required packages>
  5. Adjust and overwrite

    1. config.json (overwrite)

    2. package-solution.json (overwrite)

    3. serve.json (overwrite)

    4. src folder (overwrite)

    5. package.json: "version"

    6. .yo-rc.json: "libraryId"

    7. .eslintrc.js, tsconfig.json (adjust as needed)

  6. Test

    1. gulp build

    2. gulp serve

    3. Test in Browser (Workbench)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.