升级node.js和npm并更新/重新安装项目中的所有包

35g0bw71  于 2023-03-01  发布在  Node.js
关注(0)|答案(1)|浏览(435)

我在windows v.16.14.2上安装了Node.js,我想升级到18.14.2,所以我决定使用nvm,我使用nvm安装了16.14.2和18.14.2,并设置windows路径使用18.14.2
现在,我想升级我的项目的所有包(节点模块)。这是我尝试的,

myName@vmDEV155a MINGW64 /c/myprojectpath/myReactProject (node-npm-upgrade)
$ nvm install 18.14.2 --reinstall-packages-from=16.14.2 --latest-npm
v18.14.2 is already installed.
Now using node v18.14.2 (npm v9.5.0)

我的印象是nvm install 18.14.2 --reinstall-packages-from=16.14.2 --latest-npm命令会开始重新安装我的包,但它没有。
这是我的React项目文件夹的样子,x1c 0d1x我是否遗漏了什么?我如何更新我的包以使用新的node/npm版本?

**编辑:**运行npm outdatednpm i之后

myName@vmDEV155a MINGW64 /c/MyReact (node-npm-upgrade)
$ npm outdated
Package                              Current          Wanted          Latest  Location                                   Depended by
@babel/core                           7.14.0          7.21.0          7.21.0  node_modules/@babel/core                   MyReact
@babel/preset-react                   7.14.5          7.18.6          7.18.6  node_modules/@babel/preset-react           MyReact
@craftjs/core                   0.2.0-beta.1    0.2.0-beta.1    0.2.0-beta.8  node_modules/@craftjs/core                 MyReact
@craftjs/utils                  0.2.0-beta.1    0.2.0-beta.1    0.2.0-beta.8  node_modules/@craftjs/utils                MyReact
@lingui/cli                            2.9.2           2.9.2          3.17.1  node_modules/@lingui/cli                   MyReact
@lingui/core                           2.9.2           2.9.2          3.17.1  node_modules/@lingui/core                  MyReact
@lingui/macro                          2.9.2           2.9.2          3.17.1  node_modules/@lingui/macro                 MyReact
@lingui/react                          2.9.2           2.9.2          3.17.1  node_modules/@lingui/react                 MyReact
@material-ui/core                     4.11.4          4.12.4          4.12.4  node_modules/@material-ui/core             MyReact
@material-ui/lab              4.0.0-alpha.58  4.0.0-alpha.61  4.0.0-alpha.61  node_modules/@material-ui/lab              MyReact
@testing-library/react                12.1.5          12.1.5          14.0.0  node_modules/@testing-library/react        MyReact
@tinymce/tinymce-react                3.14.0          3.14.0           4.3.0  node_modules/@tinymce/tinymce-react        MyReact
@tippyjs/react                         4.2.5           4.2.6           4.2.6  node_modules/@tippyjs/react                MyReact
@types/jest                           25.2.3          25.2.3          29.4.0  node_modules/@types/jest                   MyReact
antlr4                                 4.8.0           4.8.0          4.12.0  node_modules/antlr4                        MyReact
assets-webpack-plugin                  5.1.2           5.1.2           7.1.1  node_modules/assets-webpack-plugin         MyReact
autoprefixer                           9.8.6           9.8.8         10.4.13  node_modules/autoprefixer                  MyReact
axios                                 0.26.1          0.26.1           1.3.4  node_modules/axios                         MyReact
babel-core                    7.0.0-bridge.0  7.0.0-bridge.0          6.26.3  node_modules/babel-core                    MyReact
babel-plugin-macros                    2.8.0           2.8.0           3.1.0  node_modules/babel-plugin-macros           MyReact
classnames                             2.3.1           2.3.2           2.3.2  node_modules/classnames                    MyReact
concurrently                           5.3.0           5.3.0           7.6.0  node_modules/concurrently                  MyReact
core-js                               2.6.12          2.6.12          3.28.0  node_modules/core-js                       MyReact
date-fns                              2.21.1          2.29.3          2.29.3  node_modules/date-fns                      MyReact
enzyme-adapter-react-16               1.15.6          1.15.7          1.15.7  node_modules/enzyme-adapter-react-16       MyReact
eslint                                 6.8.0           6.8.0          8.34.0  node_modules/eslint                        MyReact
eslint-plugin-react-hooks              4.2.0           4.6.0           4.6.0  node_modules/eslint-plugin-react-hooks     MyReact
formik                                 2.2.6           2.2.9           2.2.9  node_modules/formik                        MyReact
immer                                 9.0.12          9.0.19          9.0.19  node_modules/immer                         MyReact
jest                                  26.6.3          26.6.3          29.4.3  node_modules/jest                          MyReact
jest-junit                            12.1.0          12.1.0          15.0.0  node_modules/jest-junit                    MyReact
nanoid                                 3.3.4           3.3.4           4.0.1  node_modules/nanoid                        MyReact
postcss-loader                         3.0.0           3.0.0           7.0.2  node_modules/postcss-loader                MyReact
pubsub-js                              1.9.3           1.9.4           1.9.4  node_modules/pubsub-js                     MyReact
rc-slider                              8.7.1           8.7.1          10.1.1  node_modules/rc-slider                     MyReact
react                                16.14.0         16.14.0          18.2.0  node_modules/react                         MyReact
react-container-query                 0.12.0          0.12.1          0.12.1  node_modules/react-container-query         MyReact
react-datepicker                      2.16.0          2.16.0          4.10.0  node_modules/react-datepicker              MyReact
react-dom                            16.14.0         16.14.0          18.2.0  node_modules/react-dom                     MyReact
react-overlays                         1.2.0           1.2.0           5.2.1  node_modules/react-overlays                MyReact
react-resize-detector                  6.7.2           6.7.8           8.0.4  node_modules/react-resize-detector         MyReact
react-router-dom                       5.2.0           5.3.4           6.8.1  node_modules/react-router-dom              MyReact
react-scripts                          4.0.3           4.0.3           5.0.1  node_modules/react-scripts                 MyReact
react-test-renderer                  16.14.0         16.14.0          18.2.0  node_modules/react-test-renderer           MyReact
react-to-print                        2.14.7         2.14.12         2.14.12  node_modules/react-to-print                MyReact
react-virtualized-auto-sizer           1.0.5           1.0.7           1.0.7  node_modules/react-virtualized-auto-sizer  MyReact
react-window                           1.8.6           1.8.8           1.8.8  node_modules/react-window                  MyReact
recoil                                 0.7.0           0.7.6           0.7.6  node_modules/recoil                        MyReact
sanitize-html                          2.7.1           2.7.1          2.10.0  node_modules/sanitize-html                 MyReact
sass                                  1.49.9          1.58.3          1.58.3  node_modules/sass                          MyReact
sass-loader                           10.2.0          10.4.1          13.2.0  node_modules/sass-loader                   MyReact
style-loader                           1.3.0           1.3.0           3.3.1  node_modules/style-loader                  MyReact
styled-components                      4.4.1           4.4.1           5.3.6  node_modules/styled-components             MyReact
tinymce                               5.10.7          5.10.7           6.3.2  node_modules/tinymce                       MyReact
webpack                               4.46.0          4.46.0          5.75.0  node_modules/webpack                       MyReact
webpack-bundle-analyzer                4.4.1           4.8.0           4.8.0  node_modules/webpack-bundle-analyzer       MyReact
webpack-cli                           3.3.12          3.3.12           5.0.1  node_modules/webpack-cli                   MyReact
webpack-dev-server                    3.11.2          3.11.3          4.11.1  node_modules/webpack-dev-server            MyReact
yup                                  0.32.11         0.32.11           1.0.0  node_modules/yup                           MyReact

myname@vmDEV155a MINGW64 /c/MyReact (node-npm-upgrade)
$ rm -rf node_modules && npm i
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-config-react-app@6.0.0
npm WARN Found: eslint@6.8.0
npm WARN node_modules/eslint
npm WARN   dev eslint@"^6.8.0" from the root project
npm WARN   22 more (@neutrinojs/airbnb, @neutrinojs/eslint, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^7.5.0" from eslint-config-react-app@6.0.0
npm WARN node_modules/eslint-config-react-app
npm WARN   eslint-config-react-app@"^6.0.0" from react-scripts@4.0.3
npm WARN   node_modules/react-scripts
npm WARN
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN   peer eslint@"^7.5.0" from eslint-config-react-app@6.0.0
npm WARN   node_modules/eslint-config-react-app
npm WARN     eslint-config-react-app@"^6.0.0" from react-scripts@4.0.3
npm WARN     node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-plugin-flowtype@5.10.0
npm WARN Found: eslint@6.8.0
npm WARN node_modules/eslint
npm WARN   dev eslint@"^6.8.0" from the root project
npm WARN   22 more (@neutrinojs/airbnb, @neutrinojs/eslint, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^7.1.0" from eslint-plugin-flowtype@5.10.0
npm WARN node_modules/eslint-plugin-flowtype
npm WARN   peer eslint-plugin-flowtype@"^5.2.0" from eslint-config-react-app@6.0.0
npm WARN   node_modules/eslint-config-react-app
npm WARN   1 more (react-scripts)
npm WARN
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN   peer eslint@"^7.1.0" from eslint-plugin-flowtype@5.10.0
npm WARN   node_modules/eslint-plugin-flowtype
npm WARN     peer eslint-plugin-flowtype@"^5.2.0" from eslint-config-react-app@6.0.0
npm WARN     node_modules/eslint-config-react-app
npm WARN     1 more (react-scripts)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-webpack-plugin@2.5.4
npm WARN Found: eslint@6.8.0
npm WARN node_modules/eslint
npm WARN   dev eslint@"^6.8.0" from the root project
npm WARN   22 more (@neutrinojs/airbnb, @neutrinojs/eslint, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^7.0.0" from eslint-webpack-plugin@2.5.4
npm WARN node_modules/eslint-webpack-plugin
npm WARN   eslint-webpack-plugin@"^2.5.2" from react-scripts@4.0.3
npm WARN   node_modules/react-scripts
npm WARN
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN   peer eslint@"^7.0.0" from eslint-webpack-plugin@2.5.4
npm WARN   node_modules/eslint-webpack-plugin
npm WARN     eslint-webpack-plugin@"^2.5.2" from react-scripts@4.0.3
npm WARN     node_modules/react-scripts
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 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 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 sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated eslint-loader@4.0.2: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
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 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 @material-ui/system@4.11.3: You can now upgrade to @mui/system. See the guide: https://mui.com/guides/migration-v4/
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 @material-ui/styles@4.11.4: You can now upgrade to @mui/styles. See the guide: https://mui.com/guides/migration-v4/
npm WARN deprecated polished@2.3.3: polished@2.X is no longer supported. Please upgrade to @latest for important bug and security fixes.
npm WARN deprecated @material-ui/lab@4.0.0-alpha.58: You can now upgrade to @mui/lab. See the guide: https://mui.com/guides/migration-v4/
npm WARN deprecated core-js@2.6.12: core-js@<3.4 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. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated @material-ui/core@4.11.4: You can now upgrade to @mui/material. See the guide: https://mui.com/guides/migration-v4/

added 2752 packages, and audited 2753 packages in 10m

224 packages are looking for funding
  run `npm fund` for details

57 vulnerabilities (2 low, 5 moderate, 36 high, 14 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
63lcw9qa

63lcw9qa1#

nvm选项--reinstall-packages-from将重新安装与npm i -g一起安装的全局包。
如果没有nvm,我会清除一个项目并运行安装。

rm -rf node_modules && npm i

当有大的npm更改时,您可能必须处理警告/错误。

相关问题