【发布时间】:2020-08-17 03:03:07
【问题描述】:
尝试在 Heroku 上使用 Express 后端 + Vue 前端托管 Lerna monorepo。组件分别包含在/packages/server 和/packages/frontend 中。目的是在部署期间构建 Vue 前端,并通过 Express 将其作为静态内容托管。
./package.json
{
"name": "my_app",
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap",
"start": "lerna run start --stream",
"postinstall": "npm run bootstrap",
"build": "lerna run build --stream"
},
"devDependencies": {
"lerna": "^3.20.2"
}
}
由于
,我的构建阶段失败了lerna notice cli v3.20.2
lerna info Executing command in 2 packages: "npm run build"
frontend: > frontend@0.1.0 build /tmp/build_c2cbb32af790fe0e5e4852ce2bcab8e0/packages/frontend
frontend: > vue-cli-service build
frontend: sh: 1: vue-cli-service: not found
frontend: npm ERR! code ELIFECYCLE
frontend: npm ERR! syscall spawn
frontend: npm ERR! file sh
frontend: npm ERR! errno ENOENT
frontend: npm ERR! frontend@0.1.0 build: `vue-cli-service build`
frontend: npm ERR! spawn ENOENT
独立的 Vue 存储库不会以这种方式在其构建阶段失败,因此问题很可能是 lerna bootstrap 或 Heroku 构建事物的方式出了问题,但我无法弄清楚问题所在是。
create-react-app 的类似设置不会失败,可能是因为 react-scripts 是一个常规依赖项。
Lerna 和 devDependencies 是否有一些我遗漏的问题,或者这是 Vue 的问题?
【问题讨论】:
标签: node.js vue.js heroku npm lerna