Javascript Netlify部署(Nuxt-Storyblok CMS项目)失败`在第'阶段失败;建筑工地';:生成脚本返回非零退出代码:1`

Javascript Netlify部署(Nuxt-Storyblok CMS项目)失败`在第'阶段失败;建筑工地';:生成脚本返回非零退出代码:1`,javascript,vuejs2,nuxt.js,netlify,storyblok,Javascript,Vuejs2,Nuxt.js,Netlify,Storyblok,解决了!查看下面的详细信息。(这是一个打字错误) 我正试图使用npm run generate在Netlify中以静态方式部署项目,但在“构建站点”阶段,我收到一个失败的错误:构建脚本返回非零退出代码:1。我以前在Netlify中部署过另外两个项目(它们没有使用Storyblok,只有Nuxt),我以前从未遇到过这样的错误 该项目使用Nuxt Js(Vue Js框架)、Vuetify和Storyblok Headless CMS以及调用请求的asyncData方法。我已经按照Storyblo

解决了!查看下面的详细信息。(这是一个打字错误)





我正试图使用
npm run generate
在Netlify中以静态方式部署项目,但在“构建站点”阶段,我收到一个
失败的错误:构建脚本返回非零退出代码:1
。我以前在Netlify中部署过另外两个项目(它们没有使用Storyblok,只有Nuxt),我以前从未遇到过这样的错误

该项目使用Nuxt Js(Vue Js框架)、Vuetify和Storyblok Headless CMS以及调用请求的
asyncData
方法。我已经按照Storyblok的文档所说的方式实现了它,特别是在
numxt.config.js
中生成路由,动态更改
版本(草稿-发布),使用
Storyblok numxt
模块请求,设置Storyblok空间并创建令牌(草稿-发布),所需的组件和内容

无论是作为
npm-run-dev
(开发模式)还是使用
npm-run-generate
(本地生产模式),一切都运行良好。我使用http服务器测试了第二个,它工作完全正常

我试过:

1) 。在没有缓存的情况下重新部署

2) 。在本地运行
npm run audit
,然后运行
npm run audit fix
来修复一些漏洞(以检查它们是否是问题所在)

3) 。将Nuxt更新为最新版本(我想是2.4.0,我更新为2.8.1)

4) 。我还尝试在nuxt.config.js中注释动态路由的生成(因此只生成标准路由),以查看动态路由是否存在问题,但仍然存在类似的错误

Netlify部署中的完整日志为:

8:04:24 PM: Build ready to start
8:04:26 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
8:04:26 PM: build-image tag: v3.3.2
8:04:26 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
8:04:26 PM: Fetching cached dependencies
8:04:26 PM: Starting to download cache of 255.0KB
8:04:26 PM: Finished downloading cache in 92.256738ms
8:04:26 PM: Starting to extract cache
8:04:26 PM: Failed to fetch cache, continuing with build
8:04:26 PM: Starting to prepare the repo for build
8:04:27 PM: No cached dependencies found. Cloning fresh repo
8:04:27 PM: git clone https://github.com/alexgil1994/sofokliskourtidis
8:04:28 PM: Preparing Git Reference refs/heads/master
8:04:28 PM: Starting build script
8:04:28 PM: Installing dependencies
8:04:29 PM: Downloading and installing node v10.16.0...
8:04:30 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
8:04:30 PM: 
################################
8:04:30 PM:                            44.9%
8:04:30 PM: 
##################################################
8:04:30 PM: ###################### 100.0%
8:04:30 PM: Computing checksum with sha256sum
8:04:30 PM: Checksums matched!
8:04:33 PM: Now using node v10.16.0 (npm v6.9.0)
8:04:33 PM: Attempting ruby version 2.6.2, read from environment
8:04:34 PM: Using ruby version 2.6.2
8:04:35 PM: Using PHP version 5.6
8:04:35 PM: Started restoring cached node modules
8:04:35 PM: Finished restoring cached node modules
8:04:35 PM: Installing NPM modules using NPM version 6.9.0
8:04:59 PM: > core-js-pure@3.1.3 postinstall /opt/build/repo/node_modules/core-js-pure
8:04:59 PM: > node scripts/postinstall || echo "ignore"
8:04:59 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
8:04:59 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
8:04:59 PM: > https://opencollective.com/core-js 
8:04:59 PM: > https://www.patreon.com/zloirock 
8:04:59 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
8:04:59 PM: > nodemon@1.19.0 postinstall /opt/build/repo/node_modules/nodemon
8:04:59 PM: > node bin/postinstall || exit 0
8:04:59 PM: Love nodemon? You can now support the project via the open collective:
8:04:59 PM:  > https://opencollective.com/nodemon/donate
8:04:59 PM: > nuxt@2.8.1 postinstall /opt/build/repo/node_modules/nuxt
8:04:59 PM: > opencollective || exit 0
8:05:00 PM:                                      :-:
8:05:00 PM:                                    .==-+:
8:05:00 PM:                                   .==. :+- .-=-
8:05:00 PM:                                  .==.   :==++-+=.
8:05:00 PM:                                 :==.     -**: :+=.
8:05:00 PM:                                :+-      :*+++. .++.
8:05:00 PM:                               :+-      -*= .++: .=+.
8:05:00 PM:                              -+:      =*-   .+*: .=+:
8:05:00 PM:                             -+:     .=*-     .=*-  =+:
8:05:00 PM:                           .==:     .+*:        -*-  -+-
8:05:00 PM:                          .=+:.....:+*-.........:=*=..=*-
8:05:00 PM:                          .-=------=++============++====:
8:05:00 PM:                           Thanks for installing nuxtjs
8:05:00 PM:                  Please consider donating to our open collective
8:05:00 PM:                         to help us maintain this package.
8:05:00 PM:                            Number of contributors: 204
8:05:00 PM:                               Number of backers: 217
8:05:00 PM:                               Annual budget: $49,368
8:05:00 PM:                              Current balance: $10,815
8:05:00 PM:                  Donate: https://opencollective.com/nuxtjs/donate
8:05:01 PM: npm WARN
8:05:01 PM: optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/@nuxt/builder/node_modules/fsevents):
8:05:01 PM: npm
8:05:01 PM:  WARN notsup
8:05:01 PM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
8:05:01 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
8:05:01 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
8:05:01 PM: added 1178 packages from 583 contributors and audited 13223 packages in 25.237s
8:05:01 PM: found 0 vulnerabilities
8:05:01 PM: NPM modules installed
8:05:01 PM: Started restoring cached go cache
8:05:01 PM: Finished restoring cached go cache
8:05:02 PM: unset GOOS;
8:05:02 PM: unset GOARCH;
8:05:02 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
8:05:02 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
8:05:02 PM: go version >&2;
8:05:02 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
8:05:02 PM: go version go1.12 linux/amd64
8:05:02 PM: Installing missing commands
8:05:02 PM: Verify run directory
8:05:02 PM: Executing user command: npm run generate
8:05:02 PM: > sofokliskourtidis@1.0.0 generate /opt/build/repo
8:05:02 PM: > nuxt generate
8:05:05 PM: ℹ Production build
8:05:05 PM: ✔ Builder initialized
8:05:05 PM: ✔ Nuxt files generated
8:05:08 PM: ℹ Compiling Client
8:05:57 PM: ✔ Client: Compiled with some errors in 49.73s
8:05:57 PM: Hash: e377ffadaa01340e2904
8:05:57 PM: Version: webpack 4.33.0
8:05:57 PM: Time: 49736ms
8:05:57 PM: Built at: 06/11/2019 5:05:57 PM
8:05:57 PM:                                Asset       Size  Chunks  Chunk Names
8:05:57 PM:              05d6065413b138f1d7e5.js   11.9 KiB       8  pages/articles/posts/tags/_tag/page/_pageNum
8:05:57 PM:              0c60ef31c5ef98553702.js   6.12 KiB      38  pages/regional/posts/overview/index
8:05:57 PM:              11941b79ce20754bb795.js   1.65 KiB      31  pages/photography/posts/_id
8:05:57 PM:              14737906e17b8a20ffe4.js   4.83 KiB       9  pages/articles/posts/tags/index
8:05:57 PM:              16748f01034580cf9a1f.js   11.9 KiB      15  pages/literature-poetry/posts/search/page/_pageNum
8:05:57 PM:              16e42f3698c4cf474170.js   1.62 KiB      19  pages/movies/posts/_id
8:05:57 PM:              17399e159d7a5c9fd4ed.js   11.8 KiB      27  pages/music/posts/search/page/_pageNum
8:06:00 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
8:05:57 PM:              2cf93be146656923f6a9.js   1.69 KiB      13  pages/literature-poetry/posts/_id
8:05:57 PM:              300ad3ecf659adc49691.js   2.14 KiB       3  pages/about
8:05:57 PM:              498a6373a91c5639c50c.js   1.61 KiB      25  pages/music/posts/_id
8:06:01 PM: Shutting down logging, 104 messages pending
我们期望看到所有的路由都被生成(正常路由和动态路由),我相信崩溃发生在任何路由被创建之前(这发生在这一代的后面。我还想说,每次重新部署时抛出崩溃的时刻并不相同,它在相似的地点和时间发生,但它也发生了类似的事情,或者(稍微远一点),也更早但总是在客户端生成之后发生:

11:11:57 PM: Build ready to start
11:11:59 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:11:59 PM: build-image tag: v3.3.2
11:11:59 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
11:12:00 PM: Fetching cached dependencies
11:12:00 PM: Failed to fetch cache, continuing with build
11:12:00 PM: Starting to prepare the repo for build
11:12:00 PM: No cached dependencies found. Cloning fresh repo
11:12:00 PM: git clone https://github.com/alexgil1994/sofokliskourtidis
11:12:05 PM: Preparing Git Reference refs/heads/master
11:12:07 PM: Starting build script
11:12:07 PM: Installing dependencies
11:12:08 PM: Downloading and installing node v10.16.0...
11:12:09 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
11:12:09 PM: 
################
11:12:09 PM:    22.7%
11:12:09 PM: 
#########################################
11:12:09 PM: ###################              84.0%
11:12:09 PM: 
######################################################################## 100.0%
11:12:09 PM: Computing checksum with sha256sum
11:12:09 PM: Checksums matched!
11:12:12 PM: Now using node v10.16.0 (npm v6.9.0)
11:12:12 PM: Attempting ruby version 2.6.2, read from environment
11:12:13 PM: Using ruby version 2.6.2
11:12:13 PM: Using PHP version 5.6
11:12:13 PM: Started restoring cached node modules
11:12:13 PM: Finished restoring cached node modules
11:12:14 PM: Installing NPM modules using NPM version 6.9.0
11:12:36 PM: > core-js-pure@3.1.3 postinstall /opt/build/repo/node_modules/core-js-pure
11:12:36 PM: > node scripts/postinstall || echo "ignore"
11:12:37 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
11:12:37 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
11:12:37 PM: > https://opencollective.com/core-js 
11:12:37 PM: > https://www.patreon.com/zloirock 
11:12:37 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
11:12:37 PM: > nodemon@1.19.0 postinstall /opt/build/repo/node_modules/nodemon
11:12:37 PM: > node bin/postinstall || exit 0
11:12:37 PM: Love nodemon? You can now support the project via the open collective:
11:12:37 PM:  > https://opencollective.com/nodemon/donate
11:12:37 PM: > nuxt@2.8.1 postinstall /opt/build/repo/node_modules/nuxt
11:12:37 PM: > opencollective || exit 0
11:12:37 PM:                                      :-:
11:12:37 PM:                                    .==-+:
11:12:37 PM:                                   .==. :+- .-=-
11:12:37 PM:                                  .==.   :==++-+=.
11:12:37 PM:                                 :==.     -**: :+=.
11:12:37 PM:                                :+-      :*+++. .++.
11:12:37 PM:                               :+-      -*= .++: .=+.
11:12:37 PM:                              -+:      =*-   .+*: .=+:
11:12:37 PM:                             -+:     .=*-     .=*-  =+:
11:12:37 PM:                           .==:     .+*:        -*-  -+-
11:12:37 PM:                          .=+:.....:+*-.........:=*=..=*-
11:12:37 PM:                          .-=------=++============++====:
11:12:37 PM:                           Thanks for installing nuxtjs
11:12:37 PM:                  Please consider donating to our open collective
11:12:37 PM:                         to help us maintain this package.
11:12:37 PM:                            Number of contributors: 204
11:12:37 PM:                               Number of backers: 217
11:12:37 PM:                               Annual budget: $49,368
11:12:37 PM:                              Current balance: $10,815
11:12:37 PM:                  Donate: https://opencollective.com/nuxtjs/donate
11:12:39 PM: npm
11:12:39 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/@nuxt/builder/node_modules/fsevents):
11:12:39 PM: npm WARN
11:12:39 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:12:39 PM: npm
11:12:39 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
11:12:39 PM: npm
11:12:39 PM: WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:12:39 PM: added 1178 packages from 583 contributors and audited 13223 packages in 24.18s
11:12:39 PM: found 0 vulnerabilities
11:12:39 PM: NPM modules installed
11:12:39 PM: Started restoring cached go cache
11:12:39 PM: Finished restoring cached go cache
11:12:39 PM: unset GOOS;
11:12:39 PM: unset GOARCH;
11:12:39 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
11:12:39 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
11:12:39 PM: go version >&2;
11:12:39 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
11:12:39 PM: go version go1.12 linux/amd64
11:12:39 PM: Installing missing commands
11:12:39 PM: Verify run directory
11:12:39 PM: Executing user command: npm run generate
11:12:39 PM: > sofokliskourtidis@1.0.0 generate /opt/build/repo
11:12:39 PM: > nuxt generate
11:12:42 PM: ℹ Production build
11:12:43 PM: ✔ Builder initialized
11:12:43 PM: ✔ Nuxt files generated
11:12:45 PM: ℹ Compiling Client
11:13:38 PM: ✔ Client: Compiled with some errors in 53.34s
11:13:38 PM: Hash: e377ffadaa01340e2904
11:13:38 PM: Version: webpack 4.33.0
11:13:38 PM: Time: 53344ms
11:13:38 PM: Built at: 06/11/2019 8:13:38 PM
11:13:38 PM:                                Asset       Size  Chunks  Chunk Names
11:13:38 PM:              05d6065413b138f1d7e5.js   11.9 KiB       8  pages/articles/posts/tags/_tag/page/_pageNum
11:13:38 PM:              0c60ef31c5ef98553702.js   6.12 KiB      38  pages/regional/posts/overview/index
11:13:38 PM:              11941b79ce20754bb795.js   1.65 KiB      31  pages/photography/posts/_id
11:13:38 PM:              14737906e17b8a20ffe4.js   4.83 KiB       9  pages/articles/posts/tags/index
11:13:38 PM:              16748f01034580cf9a1f.js   11.9 KiB      15  pages/literature-poetry/posts/search/page/_pageNum
11:13:38 PM:              16e42f3698c4cf474170.js   1.62 KiB      19  pages/movies/posts/_id
11:13:38 PM:              17399e159d7a5c9fd4ed.js   11.8 KiB      27  pages/music/posts/search/page/_pageNum
11:13:38 PM:              2cf93be146656923f6a9.js   1.69 KiB      13  pages/literature-poetry/posts/_id
11:13:38 PM:              300ad3ecf659adc49691.js   2.14 KiB       3  pages/about
11:13:38 PM:              498a6373a91c5639c50c.js   1.61 KiB      25  pages/music/posts/_id
11:13:38 PM:              4e7c5059bd22566047bc.js   11.9 KiB      22  pages/movies/posts/tags/_tag/page/_pageNum
11:13:38 PM:              5703fdcb34c21e9010b9.js   6.02 KiB      20  pages/movies/posts/overview/index
11:13:38 PM:              590c5bb6b402a8e95872.js   6.25 KiB      10  pages/contact
11:13:38 PM:              5f172f247c5bdae3d529.js   11.8 KiB      21  pages/movies/posts/search/page/_pageNum
11:13:38 PM:              62aee38098ef0d84345a.js   12.6 KiB       4  pages/articles/index
11:13:38 PM:              62ca27f64ea11dbd388e.js   12.7 KiB      12  pages/literature-poetry/index
11:13:38 PM:              68570d73d3cc0726e0e1.js   11.8 KiB      33  pages/photography/posts/search/page/_pageNum
11:13:38 PM:              695064e2d97bbf093667.js   12.6 KiB      24  pages/music/index
11:13:38 PM:              69c29103b8a3228e38b8.js    113 KiB       1  app
11:13:38 PM:              6bee9e9833e8dfea8b0e.js   11.9 KiB      39  pages/regional/posts/search/page/_pageNum
11:13:38 PM:              6d59a37cdf09bf0bed9c.js    194 KiB       2  commons.app
11:13:38 PM:              6e556836004cc7d77285.js   65.6 KiB      46  vendors.pages/contact
11:13:38 PM:              715e27e7e7ebe62980e4.js   2.08 KiB      43  pages/termsconditions
11:13:38 PM:              8e3688fb9c457755f170.js   6.11 KiB      14  pages/literature-poetry/posts/overview/index
11:13:38 PM:              9b48190ec2f9aad78cda.js   3.09 KiB      42  pages/resume
11:13:42 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:13:38 PM:              9cd775f3c147971c7a28.js   12.6 KiB      30  pages/photography/index
11:13:38 PM:                             LICENSES  582 bytes          
11:13:43 PM: Shutting down logging, 85 messages pending
相反,当我在本地运行
npm run generate
时,所有对Storyblok的请求(使用Axios)都会创建所有预期的路由,而不会出现任何错误或警告

我没有共享存储库,因为它是一个私有存储库,里面有令牌,但是如果需要任何信息,请告诉我。
如果有任何想法可以尝试修复它,请告诉我并感谢您的时间。

我找到了解决方案,它与Nuxt、Storyblock或其他任何东西都没有任何关系,基本上是一个打字错误

我开始从我在不同地方拥有的潜在
console.log(…)
中清理一点项目,目的是想看看这样Netlify日志是否能提供更多细节,因为它们不会从console.log中隐藏

在清理和git推送之后,下一次部署确实在控制台中有一个更清晰的错误输出,这帮助我跟踪错误的位置。它位于
SectionImage
SVG组件中,基本上是Nuxt的SVG模块,我将
name
属性写为
SectionImage
不是每件事都做得很好






(Nuxt-Vue-Vuetify和Storyblock(第一次使用)摇滚乐!:D)

由于您的构建在本地运行良好,我建议您查找大小写问题,因为您的本地计算机可能会更宽容。请告诉我您是否可以在storyblok.com上与我们共享您的存储库,以便我们可以帮助您找到。即使文件是大写的,也可以使用小写导入,反之亦然,这可能已经是问题:)这正是问题所在!我昨天深夜发现了它,所以当时我没有精力发布解决方案,我现在就要做:)。你发现了问题所在,尽管哈哈:D(Storyblock非常棒,我使用它的体验非常棒!谢谢你提供了这么好的服务!)