nicejade / markdown-online-editor

📝基于 Vue、Vditor,所构建的在线 Markdown 编辑器,支持流程图、甘特图、时序图、任务列表、HTML 自动转换为 Markdown 等功能;🎉新增「所见即所得」编辑模式。https://niceshare.site/

Home Page:https://markdown.lovejade.cn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

构建静态文件时报错

FreshP0325 opened this issue · comments

本地和在 Netlify 使用yarn run build生产静态版本时会报


Error: Exited with 1
    at ChildProcess.child.on (/zeit/f51a0a4251865668/.build-utils/.builder/node_modules/@now/static-build/dist/index.js:34567:24)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

请教下解决方案,目测不是本地问题,谢谢

@niksend 这报错上来看,错误是有 now 报出的。请问在本地运行 yarn build 构建,有报什么错误么?

抱歉说的是 Netlify 但贴了 zeit 的错误日志

本地yarn build 会返回 Build script returned non-zero exit code:1,Netlify 上也是如此。

@niksend 嗯,这得看下具体得报错信息;比方说类似如下报错:

...
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: sass-loader requires node-sass >=4. Please install a compatible version.
....
ERROR Build failed with errors.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

如上错误的原因是: Node Sass does not yet support your current environment, 解决起来也比较简单,运行如下命令即可:

npm rebuild node-sass

当然如果是别的错误的话,也许具体分析下错误日志,才好找解决方法。

6DX6C5)9E}49K8SW_I QQKK
环境变量中没添加 vue-cli-service ,但是 coding 不支持添加这个变量。
服务器上不知道为什么会这样
4OGVOS8(Q8J7ZIF(N@FC@5S
PC上也是
image

@niksend 这个报错的,应该是依赖没有被完全安装。可以运行如下命令安装:

env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn

如果成功安装,那么在控制台直接运行如下命令(借助 npx),理论上也是可以正常构建:

npx vue-cli-service build

@FreshP0325 在最新的修改中,已经移除 prerender-spa-plugin 这个插件,这个问题已不复存在。