严格按照这里的文档构建https://v1.vuepress.vuejs.org/guide/deploy.html#netlify,但每次构建都会失败。Site在开发上表现出色,但每次部署构建都会失败。
代码库:https://github.com/MagicGary/DouglasCourses
package.json中的站点设置:
{
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
}
}Netfly部署设置
Build Command: yarn docs:build or npm run docs:build
Publish directory: docs/.vuepress/dist它说6:48:31 PM: sh: 1: vuepress: not found,我刚开始部署它们,我想它是在抱怨vuepress没有安装在生产服务器环境中,但我所做的一切都是严格按照文档操作。文档中没有提到部署部分中的任何其他内容,除此之外,

我是不是在项目的config.js中遗漏了什么?
Netfly部署错误日志
6:48:30 PM: Executing user command: npm run docs:build
6:48:31 PM: > @ docs:build /opt/build/repo
6:48:31 PM: > vuepress build docs
6:48:31 PM: sh: 1: vuepress: not found
6:48:31 PM: npm ERR!
6:48:31 PM: code ELIFECYCLE
6:48:31 PM: npm
6:48:31 PM: ERR! syscall spawn
6:48:31 PM: npm
6:48:31 PM: ERR!
6:48:31 PM: file sh
6:48:31 PM: npm
6:48:31 PM: ERR! errno ENOENT
6:48:31 PM: npm ERR! @ docs:build: `vuepress build docs`
6:48:31 PM: npm ERR! spawn ENOENT
6:48:31 PM: npm
6:48:31 PM: ERR!
6:48:31 PM: npm
6:48:31 PM: ERR!
6:48:31 PM: Failed at the @ docs:build script.
6:48:31 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
6:48:31 PM: npm
6:48:31 PM: ERR! A complete log of this run can be found in:
6:48:31 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-01-15T02_48_31_298Z-debug.log
6:48:31 PM: Skipping functions preparation step: no functions directory set
6:48:31 PM: Caching artifacts
6:48:31 PM: Started saving node modules
6:48:31 PM: Finished saving node modules
6:48:31 PM: Started saving pip cache
6:48:31 PM: Finished saving pip cache
6:48:31 PM: Started saving emacs cask dependencies
6:48:31 PM: Finished saving emacs cask dependencies
6:48:31 PM: Started saving maven dependencies
6:48:31 PM: Finished saving maven dependencies
6:48:31 PM: Started saving boot dependencies
6:48:31 PM: Finished saving boot dependencies
6:48:31 PM: Started saving go dependencies
6:48:31 PM: Finished saving go dependencies
6:48:33 PM: Error running command: Build script returned non-zero exit code: 1
6:48:33 PM: Failing build: Failed to build site
6:48:33 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
6:48:34 PM: Finished processing build request in 14.167417237s发布于 2020-01-15 11:31:17
根据您发送的链接上的文档,您必须将vuepress安装为本地依赖项
You are placing your docs inside the docs directory of your project;
You are using the default build output location (.vuepress/dist);
VuePress is installed as a local dependency in your project, and you have setup the following npm您可以使用以下链接(也提到netlify)遵循官方文档,了解如何将vuepress添加为本地依赖项
https://v1.vuepress.vuejs.org/guide/getting-started.html#inside-an-existing-project
https://stackoverflow.com/questions/59744648
复制相似问题