生产:main@HEAD 失败在“构建站点”阶段失败:构建脚本返回非零退出代码:2

问题描述 投票:0回答:1
11:29:48 AM: build-image version: 3d3c7e8b4321e2c1a54a2c4584fb46ba742b1630 (focal)
11:29:48 AM: buildbot version: 72ed9578274f76ae72cdce4c5312615aeecc32fb
11:29:49 AM: Building without cache
11:29:49 AM: Starting to prepare the repo for build
11:29:49 AM: No cached dependencies found. Cloning fresh repo
11:29:49 AM: git clone --filter=blob:none https://github.com/Essama-Official/Fictum.Web
11:29:49 AM: Preparing Git Reference refs/heads/main
11:29:52 AM: Starting to install dependencies
11:29:52 AM: Python version set to 3.8
11:29:52 AM: Attempting Ruby version 2.7.2, read from environment
11:29:53 AM: Using Ruby version 2.7.2
11:29:53 AM: Started restoring cached go cache
11:29:53 AM: Finished restoring cached go cache
11:29:54 AM: go version go1.19.13 linux/amd64
11:29:55 AM: Using PHP version 8.0
11:29:57 AM: v18.20.2 is already installed.
11:29:57 AM: Now using node v18.20.2 (npm v10.5.0)
11:29:57 AM: Enabling Node.js Corepack
11:29:57 AM: Started restoring cached build plugins
11:29:57 AM: Finished restoring cached build plugins
11:29:57 AM: Started restoring cached corepack dependencies
11:29:57 AM: Finished restoring cached corepack dependencies
11:29:57 AM: No npm workspaces detected
11:29:57 AM: Started restoring cached node modules
11:29:57 AM: Finished restoring cached node modules
11:29:57 AM: Installing npm packages using npm version 10.5.0
11:29:58 AM: npm WARN ancient lockfile
11:29:58 AM: npm WARN ancient lockfile The package-lock.json file was created with an old version of npm,
11:29:58 AM: npm WARN ancient lockfile so supplemental metadata must be fetched from the registry.
11:29:58 AM: npm WARN ancient lockfile
11:29:58 AM: npm WARN ancient lockfile This is a one-time fix-up, please be patient...
11:29:58 AM: npm WARN ancient lockfile
11:30:01 AM: added 23 packages, and audited 24 packages in 3s
11:30:01 AM: 5 packages are looking for funding
11:30:01 AM:   run `npm fund` for details
11:30:01 AM: found 0 vulnerabilities
11:30:01 AM: npm notice
11:30:01 AM: npm notice New minor version of npm available! 10.5.0 -> 10.7.0
11:30:01 AM: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.7.0>
11:30:01 AM: npm notice Run `npm install -g [email protected]` to update!
11:30:01 AM: npm notice
11:30:01 AM: npm packages installed
11:30:01 AM: Successfully installed dependencies
11:30:01 AM: Starting build script
11:30:02 AM: Detected 1 framework(s)
11:30:02 AM: "vite" at version "5.2.11"
11:30:02 AM: Section completed: initializing

当我执行 npm run build 时,我没有收到错误:

vite v5.2.10 building for production...
transforming (66) node_modules\axios\lib\axios.js
src/images/categoriesback.png referenced in C:/Users/0infi/source/repos/Projects/Projects/Fictum.Web/src/views/CategoriesPage.vue?vue&type=style&index=0&scoped=219f2274&lang.css didn't resolve at build time, it will remain unchanged to be resolved at runtime
node_modules/lottie-web/build/player/lottie.js (17010:32): Use of eval in "node_modules/lottie-web/build/player/lottie.js" is strongly discouraged as it poses security risks and may cause issues with minification.
 197 modules transformed.
dist/index.html                                       0.59 kB  gzip:   0.35 kB
dist/assets/google-play-badge-BAXiFmDF.png            4.90 kB
dist/assets/youtube-B2-ob9Jb.png                      8.54 kB
dist/assets/download-on-the-app-store-DEgUYCrT.svg    8.85 kB  gzip:   3.72 kB
dist/assets/linkedin-DgLzhU7_.png                    11.48 kB
dist/assets/fictumimage-cAnU0aOI.svg                 13.00 kB  gzip:   4.06 kB
dist/assets/facebook-ejnf6rkB.png                    16.04 kB
dist/assets/google-Bp_336oh.png                      20.87 kB
dist/assets/twitter-CPWSm0NQ.png                     23.63 kB
dist/assets/tik-tok-C3xTsDPx.png                     23.80 kB
dist/assets/threads-BfxrDhYb.png                     25.52 kB
dist/assets/apple_logo-veUP97vU.png                  57.02 kB
dist/assets/instagram-VUFQ3l_n.png                   60.38 kB
dist/assets/index-D9yWPND-.css                      262.04 kB  gzip:  34.54 kB
dist/assets/index-DJlyPodN.js                       976.53 kB  gzip: 271.67 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
 built in 10.03s

package.json:

{
  "name": "vue-project",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@capacitor/core": "^5.7.4",
    "axios": "^1.6.8",
    "bootstrap": "^5.3.3",
    "chart.js": "^4.4.2",
    "js-sha512": "^0.9.0",
    "twilio": "^5.0.4",
    "vue": "^3.3.11",
    "vue-chartjs": "^5.3.0",
    "vue-router": "^4.2.5",
    "vue3-lottie": "^3.3.0",
    "vuex": "^4.1.0"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.5.2",
    "vite": "^5.0.10"
  }
}

我尝试过:npm install vue-lottie@latest --save。 npm install --legacy-peer-deps。在同一问题中使用此方法:“转到站点设置 > 构建和部署 > 持续部署。转到构建设置 > 编辑设置。将构建命令编辑为 CI= npm run build 等...”。 另外: CI 值为 false NPM_FLAGS 的值为 --legacy-peer-deps

vue.js npm vuejs3 netlify
1个回答
0
投票

我实现了让它发挥作用。这是我应用修复的相关 Github 存储库

有很多事情需要修复:

  • 删除
    node_modules
    ,取消跟踪它们,重新生成整个
    package-lock.json
    ,我为此使用了 npm
    v10.2.3
    和 Node
    v20.10.0
    (否则我遇到了一些权限问题)+不要忘记编辑
    .gitignore
    也归档
  • 您在
    import Lottie from 'vue-lottie/src/lottie.vue';
     中仍然有一些 
    src/views/GonePage.vue
  • 的实例
  • 图像未正确加载到
    src/views/CategoriesPage.vue
    ,我还修复了给出的这个答案

我使用以下设置部署在 Netlify 上:

  • 基本目录:
    /
  • 构建命令:
    npm run build
  • 发布目录:
    dist

该构建现在在本地和生产环境中都能完美运行。


同时,你有一个大包,其中的资产太大了,比如

ecology.png
。我建议使用 Squoosh 将其从
1.05 MB
变为
91.9 kB
,而不会造成感知损失。再次构建,通知您这部分。


顺便说一句,你也有一个安全问题,因为当 git 推送时我被告知你有一个私人 Twilio 令牌暴露。我需要点击链接将其列入白名单。我不确定您在代码中的何处使用它,但它肯定是暴露的且危险的。我建议使用

.env
并生成一个新的!

我没有花时间修复它,因为我在您的代码中找不到 Twilio 实例,我认为您可以自己修复它。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.