首页 > 解决方案 > 在共享主机上使用 vue-cli-service build / npm run build 时出错(创建工作池时出错)

问题描述

当我尝试在共享托管服务上构建我的 Vue 项目时,它显示错误:

点击此链接查看错误

但是当我npm run build在本地环境中运行时,它工作得很好。

错误详情:

     Building for production.../home/intechpe/onlineku-admin/node_modules/thread-loader/dist/WorkerPool.js:53
      throw new Error(`Failed to create the worker pool with workerId: ${workerId} and ${''}configuration: ${JSON.stringify(options)}. Please verify if you hit the OS open files limit.`);
      ^

Error: Failed to create the worker pool with workerId: 4 and configuration: {"parallelJobs":20}. Please verify if you hit the OS open files limit.
    at new PoolWorker (/home/intechpe/onlineku-admin/node_modules/thread-loader/dist/WorkerPool.js:53:13)
    at WorkerPool.createWorker (/home/intechpe/onlineku-admin/node_modules/thread-loader/dist/WorkerPool.js:337:23)
    at WorkerPool.distributeJob (/home/intechpe/onlineku-admin/node_modules/thread-loader/dist/WorkerPool.js:331:28)
    at runQueue (/home/intechpe/onlineku-admin/node_modules/neo-async/async.js:8097:9)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! onlineku-admin@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the onlineku-admin@0.1.0 build 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!     /home/intechpe/.npm/_logs/2019-05-17T09_44_00_691Z-debug.log

标签: node.jsvue.jsvuejs2

解决方案


以前我在运行时在 cPanel ssh 上遇到同样的问题npm run build。但是当我使用这个命令时它是有效的:

npx vue-cli-service build


推荐阅读