1

我一直在尝试在 netlify 上部署一段时间。这里这里这里的所有建议都不起作用。有什么建议么?

项目正在使用Ionic 5.x Vue 3.0.0-rc.10

网络化错误

7:30:00 PM: ┌───────────────────────────────────┐
7:30:00 PM: │ 1. Build command from Netlify app │
7:30:00 PM: └───────────────────────────────────┘
7:30:00 PM: ​
7:30:00 PM: $ npm run build
7:30:00 PM: > ionic-vue-mobile-template-01@0.2.0 build /opt/build/repo
7:30:00 PM: > vue-cli-service build
7:30:01 PM: -  Building for production...
7:30:06 PM:  ERROR  Failed to compile with 1 errors5:30:06 PM
7:30:06 PM: Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
7:30:06 PM: Thread Loader (Worker 0)
7:30:06 PM: No ESLint configuration found in /opt/build/repo/src.
7:30:06 PM:     at PoolWorker.fromErrorObj (/opt/build/repo/node_modules/thread-loader/dist/WorkerPool.js:262:12)
7:30:06 PM:     at /opt/build/repo/node_modules/thread-loader/dist/WorkerPool.js:204:29
7:30:06 PM:     at mapSeries (/opt/build/repo/node_modules/neo-async/async.js:3625:14)
7:30:06 PM:     at CascadingConfigArrayFactory._finalizeConfigArray (/opt/build/repo/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:432:19)
7:30:06 PM:     at CascadingConfigArrayFactory.getConfigArrayForFile (/opt/build/repo/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
7:30:06 PM:     at CLIEngine.isPathIgnored (/opt/build/repo/node_modules/eslint/lib/cli-engine/cli-engine.js:951:18)
7:30:06 PM:     at CLIEngine.executeOnText (/opt/build/repo/node_modules/eslint/lib/cli-engine/cli-engine.js:868:38)
7:30:06 PM:     at lint (/opt/build/repo/node_modules/eslint-loader/index.js:278:17)
7:30:06 PM:     at transform (/opt/build/repo/node_modules/eslint-loader/index.js:252:18)
7:30:06 PM:     at /opt/build/repo/node_modules/loader-fs-cache/index.js:127:18
7:30:06 PM:     at ReadFileContext.callback (/opt/build/repo/node_modules/loader-fs-cache/index.js:31:14)
7:30:06 PM:     at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:257:13)
7:30:06 PM: You may use special comments to disable some warnings.
7:30:06 PM: Use // eslint-disable-next-line to ignore the next line.
7:30:06 PM: Use /* eslint-disable */ to ignore all warnings in a file.
7:30:06 PM:  ERROR  Build failed with errors.
7:30:06 PM: npm ERR! code ELIFECYCLE
7:30:06 PM: npm ERR! errno 1
7:30:06 PM: npm ERR! ionic-vue-mobile-template-01@0.2.0 build: `vue-cli-service build`
7:30:06 PM: npm ERR! Exit status 1
7:30:06 PM: npm ERR!
7:30:06 PM: npm ERR! Failed at the ionic-vue-mobile-template-01@0.2.0 build script.
7:30:06 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
7:30:06 PM: npm ERR! A complete log of this run can be found in:
7:30:06 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-09-20T17_30_06_897Z-debug.log
7:30:06 PM: ​
7:30:06 PM: ┌─────────────────────────────┐
7:30:06 PM: │   "build.command" failed    │
7:30:06 PM: └─────────────────────────────┘
7:30:06 PM: ​
7:30:06 PM:   Error message
7:30:06 PM:   Command failed with exit code 1: npm run build
7:30:06 PM: ​
7:30:06 PM:   Error location
7:30:06 PM:   In Build command from Netlify app:
7:30:06 PM:   npm run build
7:30:06 PM: ​
7:30:06 PM:   Resolved config
7:30:06 PM:   build:
7:30:06 PM:     command: npm run build
7:30:06 PM:     commandOrigin: ui
7:30:06 PM:     publish: /opt/build/repo/dist
7:30:07 PM: Caching artifacts
7:30:07 PM: Started saving node modules
7:30:07 PM: Finished saving node modules
7:30:07 PM: Started saving build plugins
7:30:07 PM: Finished saving build plugins
7:30:07 PM: Started saving pip cache
7:30:07 PM: Finished saving pip cache
7:30:07 PM: Started saving emacs cask dependencies
7:30:07 PM: Finished saving emacs cask dependencies
7:30:07 PM: Started saving maven dependencies
7:30:07 PM: Finished saving maven dependencies
7:30:07 PM: Started saving boot dependencies
7:30:07 PM: Finished saving boot dependencies
7:30:07 PM: Started saving go dependencies
7:30:07 PM: Finished saving go dependencies
7:30:09 PM: Error running command: Build script returned non-zero exit code: 2
7:30:09 PM: Failing build: Failed to build site
7:30:09 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
7:30:09 PM: Finished processing build request in 1m14.452560076s
4

1 回答 1

2

问题是缺少.eslintrc.js文件。我用这个配置创建

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/vue3-essential',
    'eslint:recommended',
    '@vue/typescript/recommended'
  ],
  parserOptions: {
    ecmaVersion: 2020
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'vue/no-deprecated-slot-attribute': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
  },
  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)'
      ],
      env: {
        jest: true
      }
    }
  ]
}

于 2020-09-21T15:54:34.460 回答