npm run dev failed
TRQYC opened this issue · 2 comments
运行 npm run dev 报错如下 (node v16.14.2), 辛苦看下
frontend@0.0.0 dev
vite
/Users/XXX/Downloads/mpcb-master/frontend/node_modules/esbuild/bin/esbuild:2
throw new Error(`esbuild: Failed to install correctly
^
Error: esbuild: Failed to install correctly
Make sure you don't have "ignore-scripts" set to true. You can check this with
"npm config get ignore-scripts". If that returns true you can reset it back to
false using "npm config set ignore-scripts false" and then reinstall esbuild.
If you're using npm v7, make sure your package-lock.json file contains either
"lockfileVersion": 1 or the code "hasInstallScript": true. If it doesn't have
either of those, then it is likely the case that a known bug in npm v7 has
corrupted your package-lock.json file. Regenerating your package-lock.json file
should fix this issue.
第一步:当前目录下,执行:node ./node_modules/esbuild/install.js
,就会生成esbuild/esbuild.exe的文件
第二步:启动npm run dev
执行过程如下:
PS mpcb-master\frontend> npm run dev
> frontend@0.0.0 dev
> vite
node:events:504
throw er; // Unhandled 'error' event
^
Error: spawn mpcb-master\frontend\node_modules\esbuild\esbuild.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn mpcb-master\\frontend\\node_modules\\esbuild\\esbuild.exe',
path: 'mpcb-master\\frontend\\node_modules\\esbuild\\esbuild.exe',
spawnargs: [ '--service=0.12.24', '--ping' ]
}
PS mpcb-master\frontend> node ./node_modules/esbuild/install.js
PSmpcb-master\frontend> npm run dev
> frontend@0.0.0 dev
> vite
Pre-bundling dependencies:
vue
dayjs
js-cookie
mockjs
dexie
(...and 2 more)
(this will be run only when your dependencies or config have changed)
vite v2.5.1 dev server running at:
> Local: http://localhost:3000/
> Network: use `--host` to expose
ready in 744ms.
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
🌼 DaisyUI components 1.14.0 https://github.com/saadeghi/daisyui
✔︎ Including: base, components, themes[1], utilities
[@vue/compiler-sfc] `defineEmits` is a compiler macro and no longer needs to be imported.
@TRQYC @510850111
抱歉,最近工作忙,没啥时间debug。
可以看看之前用 electron 打包的应用能否使用 https://github.com/moreant/mpcb-for-electron
这个是在蓝奏云的下载地址:
https://moreant.lanzoul.com/b01cpng1e
密码:fedu