前端工程npm编译报错

报错内容

npm run build:base

> dataease@0.0.0 build:base
> set NODE_OPTIONS=--max_old_space_size=4096 vite build --mode base && npm run build:flush


> dataease@0.0.0 build:flush
> cd ./flushbonading && rimraf ./demo.html && npm i && node ./index.js


up to date in 6s

6 packages are looking for funding
  run `npm fund` for details
(node:33936) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'D:\code\github\dataease\core\core-frontend\dist\panel.html'
Emitted 'error' event on ReadStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'D:\\code\\github\\dataease\\core\\core-frontend\\dist\\panel.html'
}

具体操作参考这边,核对对应的步骤:源码部署 - DataEase 文档

按官方的步骤一步一步做也报这个错


按照源码部署文档,自己排查一下。

找到原因
原始的build base参数如下
“NODE_OPTIONS=–max_old_space_size=4096 vite build --mode base && npm run build:flush”

这个在win中是无法运行的,因此在前面加了一个set,变成
“set NODE_OPTIONS=–max_old_space_size=4096 vite build --mode base && npm run build:flush”

改完之后由于vite build --mode base前面没有&&,导致这段无法运行,就报上面的错,加上&&就好了
“set NODE_OPTIONS=–max_old_space_size=4096 && vite build --mode base && npm run build:flush”

咱就是说npm run build:flush前面都加&&了,为啥vite build --mode base前面不加呢?
这问题也没在官方文档里写呢……

我的错和你的一样,按照你的方法改了重新编译也不行呢

本地环境问题,检查一下,开发问题自己多研究