检查过时软件包
1 |
npm outdated |
更新
1 2 |
npm update npm update --save // version 8.x 更新package.json |
运行报错及处理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
PS H:\project\web\demo\vue3\vite-project> npm run dev > vite-project@0.0.0 dev H:\project\web\demo\vue3\vite-project > cross-env NODE_ENV=development vite failed to load config from H:\project\web\demo\vue3\vite-project\vite.config.ts error when starting dev server: Error: The package "esbuild-windows-64" could not be found, and is needed by esbuild. If you are installing esbuild with npm, make sure that you don't specify the "--no-optional" flag. The "optionalDependencies" package.json feature is used by esbuild to install the correct binary executable for your current platform. at generateBinPath (H:\project\web\demo\vue3\vite-project\node_modules\esbuild\lib\main.js:1816:15) at esbuildCommandAndArgs (H:\project\web\demo\vue3\vite-project\node_modules\esbuild\lib\main.js:1872:31) at ensureServiceIsRunning (H:\project\web\demo\vue3\vite-project\node_modules\esbuild\lib\main.js:2034:25) at Object.build (H:\project\web\demo\vue3\vite-project\node_modules\esbuild\lib\main.js:1927:26) at bundleConfigFile (H:\project\web\demo\vue3\vite-project\node_modules\vite\dist\node\chunks\dep-e1fc1d62.js:61932:34) at loadConfigFromFile (H:\project\web\demo\vue3\vite-project\node_modules\vite\dist\node\chunks\dep-e1fc1d62.js:61909:35) at resolveConfig (H:\project\web\demo\vue3\vite-project\node_modules\vite\dist\node\chunks\dep-e1fc1d62.js:61436:34) at createServer (H:\project\web\demo\vue3\vite-project\node_modules\vite\dist\node\chunks\dep-e1fc1d62.js:59843:26) at CAC.<anonymous> (H:\project\web\demo\vue3\vite-project\node_modules\vite\dist\node\cli.js:688:30) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vite-project@0.0.0 dev: `cross-env NODE_ENV=development vite` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the vite-project@0.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\beiyu\AppData\Roaming\npm-cache\_logs\2022-05-07T02_40_34_327Z-debug.log |
删除node_modules
,重新安装再运行
1 2 3 |
PS H:\project\web\demo\vue3\vite-project> rimraf .\node_modules\ PS H:\project\web\demo\vue3\vite-project> npm install PS H:\project\web\demo\vue3\vite-project> npm run dev |
官方文档
npm-outdated
:https://docs.npmjs.com/cli/v8/commands/npm-outdated