Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js Vuepress部署到Netfly失败_Vue.js_Vuepress - Fatal编程技术网

Vue.js Vuepress部署到Netfly失败

Vue.js Vuepress部署到Netfly失败,vue.js,vuepress,Vue.js,Vuepress,严格遵守此处的文档 但每次构建都会失败。 该站点在开发方面表现出色,但每次部署构建都会失败 代码库: package.json中的站点设置: { “脚本”:{ “文档:开发”:“vuepress开发文档”, “文档:生成”:“vuepress生成文档” } } Netfly部署设置 Build Command: yarn docs:build or npm run docs:build Publish directory: docs/.vuepress/dist 它说,6:48:31 PM:

严格遵守此处的文档 但每次构建都会失败。 该站点在开发方面表现出色,但每次部署构建都会失败

代码库:

package.json中的站点设置:

{
“脚本”:{
“文档:开发”:“vuepress开发文档”,
“文档:生成”:“vuepress生成文档”
}
}
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

根据您发送的链接文档,必须将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添加为本地依赖项的官方文档


谢谢你的建议。我已经尝试过了,并使用
npm install
在本地安装了它。它构建成功,但这就是它的样子,同样,当我将它部署到heroku时,它说
npm ERR!缺少脚本:start
@BaoYutong鲍昱彤 你能准确地输入你使用的npm命令吗?它必须是npm安装-D vuepress,而不仅仅是npm安装vuepress。关于第二个错误,我猜在脚本设置中,您需要添加“docs:start”npm安装-D VuePress请在Hi处仔细检查您的
base
设置,我还没有时间深入研究它。但是官方文档网站现在是