Sp-dev-docs: Getting old version of React in the package when create Sharepoint webpart

Created on 5 Mar 2020  路  7Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [x] Bug

I have created the Sharepoint webpart by running yo @microsoft/sharepoint and I got all the old versions of react and related packages in package.json.

react

To resolve this issue,

I have removed existing node package and installed the latest version 12.16.1
- when I run npm -v, I get v.12.16.1
ran npm i npm@latest -g
- now npm version 6.15.2
ran npm install @microsoft/generator-sharepoint@latest -g
- now i have @microsoft/[email protected]

but after I upgraded the node/npm and created the new webpart, I still get the old react versions in package.json.

I would need at least react 16.8 or higher version in order to use some of the react libraries.

Any ideas?

spfx-general answered question

All 7 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Hi,

What's your package version if you run npm outdated -g, I just did upgrade my local environment from 1.8 to 1.10 successfully.

Update SharePoint Framework packages

Lee
Microsoft SharePoint Community Support

Hi,
Try to use node version 10.18.0 for better SPFx compatibility. I dont think so v12.x.x is support for SPFx.

The latest supported nodejs version 10.19.0.

The current supported LTS version of NodeJS for the SharePoint Framework is Node.js v8.x and Node.js v10.x.

Notice that 9.x, 11.x or 12.x versions are currently not supported with SharePoint Framework development.

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment#install-developer-tools

Try to use the latest node version

@PrasadKasireddy said:

Try to use the latest node version

No, that's not correct. Don't use the latest... use what's listed as supported and recommended on the page you linked to.

@hh747hh need more context... what environment are you targetting? I suspect you are pointing to SharePoint 2016 / SharePoint 2019. Those only have React v15... they don't support React v16 as React v16 was added to a later version of SPFx than what's available on-prem.

@PrasadKasireddy said:

Try to use the latest node version

No, that's not correct. Don't use the latest... use what's listed as supported and recommended on the page you linked to.

@hh747hh need more context... what environment are you targetting? I suspect you are pointing to SharePoint 2016 / SharePoint 2019. Those only have React v15... they don't support React v16 as React v16 was added to a later version of SPFx than what's available on-prem.

it's my mistake, it's a type of error - Try to use the latest node version (10.19) instead of 10.18.

Closing this issue as "answered". If you encounter a similar issue(s), please open up a new issue. See our wiki for more details: Issue-List: Our approach to closed issues

Was this page helpful?
0 / 5 - 0 ratings