【发布时间】:2021-03-08 19:02:55
【问题描述】:
我正在使用 Vue.js 2 开发应用程序。我使用的是 Ubuntu 20.04.1 LTS。我的package.json 文件如下所示:
{
"name": "my-app",
"version": "0.0.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"vue": "^2.6.12",
"vue-router": "^3.4.9",
"vuex": "^3.6.2",
"vuex-persistedstate": "^4.0.0-beta.3",
...and others
},
"devDependencies": {
...some dependencies
}
}
当我运行npm run build 时,出现以下异常:
> vue-cli-service build
⠹ Building for production...internal/child_process.js:403
throw errnoException(err, 'spawn');
^
Error: spawn E2BIG
at ChildProcess.spawn (internal/child_process.js:403:11)
at Object.spawn (child_process.js:553:9)
at new PoolWorker (/workspace/___/___/___/node_modules/thread-loader/dist/WorkerPool.js:46:43)
at WorkerPool.createWorker (/workspace/___/___/___/node_modules/thread-loader/dist/WorkerPool.js:341:23)
at WorkerPool.distributeJob (/workspace/___/___/___/node_modules/thread-loader/dist/WorkerPool.js:335:28)
at runQueue (/workspace/___/___/___/node_modules/neo-async/async.js:8099:9)
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
errno: -7,
code: 'E2BIG',
syscall: 'spawn'
}
npm ERR! code 1
npm ERR! path /workspace/___/___/___
npm ERR! command failed
npm ERR! command sh -c vue-cli-service build
npm ERR! A complete log of this run can be found in:
npm ERR! /home/___/.npm/_logs/2021-03-08T18_57_06_018Z-debug.log
但是,当我运行 npm run serve 时,一切正常。这里有什么问题?如果您需要我未包含的任何其他文件,请告诉我。
【问题讨论】:
-
您的整个项目是否有任何 ESlint 错误?
-
npm run serve不会返回任何警告或错误,它工作正常。我还尝试从package.json中删除所有与 ESlint 相关的依赖项并再次重新安装所有依赖项,但问题仍然存在。