Netlify部署(Nuxt-Storyblok CMS项目)失败。 `在“建筑工地”阶段失败:构建脚本返回了非零退出代码:1`

时间:2019-06-11 17:42:39

标签: javascript vuejs2 nuxt.js netlify storyblok

解决了!看下面的更多细节。 (这是一个错字)





我正在尝试使用npm run generate在Netlify中将项目部署为静态,但是出现了failed during stage 'building site': Build script returned non-zero exit code: 1错误。我以前在Netlify中部署了另外2个项目(它们没有使用Storyblok,仅使用Nuxt),而且之前没有出现这样的错误。

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

一切都很好,无论是在本地作为npm run dev(开发模式)还是使用npm run generate(本地生产模式)。我使用http-server测试了第二个,它完全可以正常工作。

我尝试过:

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)都会创建所有预期的路由,而不会出现任何错误或警告。

我没有共享存储库,因为它是一个私有存储库,并且内部有令牌,但是如果需要任何信息,请告诉我。 如果有任何想法可以解决,请赐教给我,谢谢您的宝贵时间。

1 个答案:

答案 0 :(得分:1)

我找到了解决方案,它与Nuxt,Storyblok或其他都没有任何关系,基本上是一个错字。

我开始从各个地方的潜在console.log(...)中清除项目,其目的是要查看Netlify日志是否可以为我提供更多详细信息,因为它们不会被隐藏。 console.logs。

在清理和git push之后,下一次部署的确在控制台中输出了更清晰的错误,这有助于我跟踪错误所在。正是在SectionImage SVG组件中,该组件基本上与Nuxt的SVG模块一起使用,我将name属性写为Sectionimage。因此,在修复它之后,一切都运行良好!





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