Recently while deploying a reactjs app as azure static web app, the automatic upgradation of node and npm caused error related to peer dependency.
Previous versions-
Using Node version:v14.19.1
Using Npm version:6.14.16
Current versions-
Using Node version:v16.18.0
Using Npm version:8.19.2
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @date-io/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/date-fns
npm WARN date-fns@"^2.29.3" from the root project
npm WARN 2 more (@mui/x-date-pickers, @date-io/date-fns)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer date-fns@"2.0.0-alpha.27" from @date-io/[email protected]
npm WARN node_modules/@date-io/date-fns
npm WARN @date-io/date-fns@"1.1.0" from [email protected]
npm WARN node_modules/material-table
What is the proper solution to resolve this issue, as I tried adding a task in yml file to upgrade node version, it did not work
CodePudding user response:
The node.js is determined by project itself. It is not able to be set in YAML Pipeline via adding task.
Or you can define the Engines field in Package.json file.
For example:
{
...
"engines": {
"npm": "^6.14.17",
"node": "^v14.20.1"
},
....
}
Result: