NodeJS React:从React 16.0.0转换为React 18 issue

9avjhtql  于 2023-06-22  发布在  Node.js
关注(0)|答案(1)|浏览(242)

请找到我的package.json文件和jenkins build失败,说明这些问题。请帮助解决这些问题。npm版本:8.15.0. node version v16.17.1我正在尝试从react 16转换到react 18,请帮助如何解决这些问题。npm版本:8.15.0. node版本v16.17.1我正在尝试从react 16转换到react 18

package.json
{

  "name": "testprj",

  "version": "0.1.0",

  "private": true,

  "dependencies": {

    "@ckeditor/ckeditor5-react": "^5.0.6",

    "axios": "^0.21.4",

    "bootstrap": "^4.1.3",

    "ckeditor5-build-classic-extended": "^20.0.1",

    "classnames": "^2.3.1",

    "dotenv": "^16.0.0",

    "env-cmd": "^10.1.0",

    "html-entities": "^2.3.3",

    "html-react-parser": "^3.0.4",

    "i": "^0.3.7",

    "jquery": "^3.4.1",

    "merge": "^1.2.1",

    "npm": "^8.18.0",

    "oidc-client": "^1.9.0",

    "react": "^18.2.0",

    "react-bootstrap": "^2.2.2",

    "react-dom": "^18.2.0",

    "react-html-parser": "^2.0.2",

    "react-router-bootstrap": "^0.25.0",

    "react-router-dom": "^5.1.2",

    "react-scripts": "^3.4.1",

    "react-tabs": "^4.2.0",

    "react-xml-parser": "^1.1.8",

    "reactstrap": "^8.4.1",

    "rechoir": "^0.8.0",

    "rimraf": "^2.6.2",

    "shelljs": "^0.8.5",

    "shx": "^0.3.4",

    "styled-components": "^5.3.5"

  },

  "devDependencies": {

    "ajv": "^6.9.1",

    "cross-env": "^5.2.0",

    "eslint": "^6.8.0",

    "eslint-config-react-app": "^5.2.0",

    "eslint-plugin-flowtype": "^4.6.0",

    "eslint-plugin-import": "^2.20.1",

    "eslint-plugin-jsx-a11y": "^6.2.3",

    "eslint-plugin-react": "^7.18.3",

    "nan": "^2.14.1"

  },

  "eslintConfig": {

    "extends": "react-app"

  },

  "scripts": {

    "start": "rimraf ./build && react-scripts start",

    "build:dev": "env-cmd -f .env.dev react-scripts build && shx rm -rf build-dev && shx cp -r build build-dev",

    "build:sit": "env-cmd -f .env.sit react-scripts build && shx rm -rf build-sit && shx cp -r build build-sit",

    "build:qa": "env-cmd -f .env.qa react-scripts build && shx rm -rf build-qa && shx cp -r build build-qa",

    "build:uat": "env-cmd -f .env.uat react-scripts build && shx rm -rf build-uat && shx cp -r build build-uat",

    "build:prod": "env-cmd -f .env react-scripts build && shx rm -rf build-prod && shx cp -r build build-prod",

    "build": "react-scripts build",

    "test": "cross-env CI=true react-scripts test --env=jsdom",

    "eject": "react-scripts eject",

    "lint": "eslint ./src/"

  },

  "browserslist": {

    "production": [

      ">0.2%",

      "not dead",

      "not op_mini all"

    ],

    "development": [

      "last 1 chrome version",

      "last 1 firefox version",

      "last 1 safari version"

    ]

  }

}

议题

npm install --legacy-peer-deps

npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility

npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated

npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.

npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

npm WARN deprecated har-validator@5.1.5: this library is no longer supported

npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated

npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies

npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies

npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.

npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()

npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added

npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'

npm WARN deprecated eslint-loader@3.0.3: This loader has been deprecated. Please use eslint-webpack-plugin

npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.

npm WARN deprecated html-webpack-plugin@4.0.0-beta.11: please switch to a stable version

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'

npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1

npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
jvidinwx

jvidinwx1#

React 16到17是一个维护版本(没有破坏性的更改),17到18引入了一些只会影响使用typescript的项目的更改。我看到你的包了,json没有。您在控制台中看到的是弃用警告,这些不会影响本地运行,但如果Jenkins已配置为将警告视为错误,则在Jenkins上构建将失败。
如果此生成用于预生产环境,并且您需要推送此生成,请在以下行中搜索设置-如果警告超过指定的计数,则中断生成,或者如果警告超过上次签入的警告,则中断生成。如果Jenkins配置是旧的,那么管道中可能还有一个现已弃用的警告插件,可能会导致构建在警告时失败。
否则,你可以尝试逐个解决依赖警告,这实际上可能会破坏你的构建,甚至导致所谓的“依赖地狱”,因为所有这些依赖警告都需要重大更新。

相关问题