Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro v3.5.x 使用自定义环境变量报 ValidationError 错误信息. #12436

Closed
hqwlkj opened this issue Sep 5, 2022 · 2 comments · Fixed by #12535
Closed

Taro v3.5.x 使用自定义环境变量报 ValidationError 错误信息. #12436

hqwlkj opened this issue Sep 5, 2022 · 2 comments · Fixed by #12535
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@hqwlkj
Copy link
Contributor

hqwlkj commented Sep 5, 2022

相关平台

H5

浏览器版本: Chrome 版本 104.0.5112.101(正式版本) (x86_64)
使用框架: React

复现步骤

自定义一个环境变量,进行编译运行就会报错.

期望结果

正常打包运行

实际结果

$ cross-env NODE_ENV=staging yarn build:h5
$ taro build --type h5
👽 Taro v3.5.2

当前运行环境: staging
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.mode should be one of these:
   "development" | "production" | "none"
   -> Enable production optimizations or development hints.
    at validate (/Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/webpack/node_modules/schema-utils/dist/validate.js:105:11)
    at validateSchema (/Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/webpack/lib/validateSchema.js:78:2)
    at create (/Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/webpack/lib/webpack.js:111:24)
    at webpack (/Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/webpack/lib/webpack.js:158:32)
    at f (/Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/webpack/lib/index.js:63:16)
    at /Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/@tarojs/webpack5-runner/src/index.h5.ts:41:31
    at Generator.next (<anonymous>)
    at fulfilled (/Users/yanghc/Work/ParsecProject/sculptor-h5/node_modules/@tarojs/webpack5-runner/dist/index.h5.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errors: [
    {
      keyword: 'enum',
      dataPath: '.mode',
      schemaPath: '#/definitions/Mode/enum',
      params: [Object],
      message: 'should be equal to one of the allowed values',
      schema: [Array],
      parentSchema: [Object],
      data: 'staging'
    }
  ],

环境信息

Taro CLI 3.5.2 environment info:
    System:
      OS: macOS 11.6.8
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
      Yarn: 1.22.19 - /usr/local/bin/yarn
      npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.5.2 => 3.5.2 
      @tarojs/components: 3.5.2 => 3.5.2 
      @tarojs/helper: 3.5.2 => 3.5.2 
      @tarojs/plugin-framework-react: 3.5.2 => 3.5.2 
      @tarojs/plugin-platform-weapp: 3.5.2 => 3.5.2 
      @tarojs/react: 3.5.2 => 3.5.2 
      @tarojs/router: 3.5.2 => 3.5.2 
      @tarojs/runtime: 3.5.2 => 3.5.2 
      @tarojs/shared: 3.5.2 => 3.5.2 
      @tarojs/taro: 3.5.2 => 3.5.2 
      @tarojs/taro-h5: 3.5.2 => 3.5.2 
      babel-preset-taro: 3.5.2 => 3.5.2 
      eslint-config-taro: 3.5.2 => 3.5.2 
      react: ^18.0.0 => 18.2.0
@jsLWQ
Copy link

jsLWQ commented Sep 20, 2022

请问解决了吗,

@dongpobaicai
Copy link

修复了,升级到3.5.6还是报这个错误

@ZakaryCode ZakaryCode moved this to Done in H5 Apr 10, 2023
@ZakaryCode ZakaryCode added this to H5 Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants