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

配置环境变量启动报错 #5079

Closed
overcastsky opened this issue Jul 23, 2020 · 5 comments
Closed

配置环境变量启动报错 #5079

overcastsky opened this issue Jul 23, 2020 · 5 comments

Comments

@overcastsky
Copy link

What happens?

想要配置不同环境的打包命令,
"start:dev": "cross-env UMI_ENV=dev umi dev",
cross-env已安装
启动时报错信息如下:
get user config failed, undefined does not exist, but process.env.UMI_ENV is set to dev.

相关环境信息

  • Umi 版本:3.0.16
  • Node 版本:12.18.3
  • 操作系统:macos
@zlh
Copy link

zlh commented Jul 23, 2020

请问你是怎么解决的?

@zm8
Copy link

zm8 commented Sep 24, 2020

请问你是怎么解决的?
需要新增 .umirc.dev.ts 文件。

建议官方不要报错,而是忽略,
因为实战当中,有时就只需要一个文件就行了。

@xiaomingyu-git
Copy link

请问你是怎么解决的?
在 tsconfig中 ,在include里把自己环境变量的文件加上。
我配置的环境叫qa 定义的文件名是 .umirc.qa.ts
如下。
"include": [
"mock//*",
"src/
/",
"config/**/
",
".umirc.ts",
".umirc.qa.ts",
"typings.d.ts"
],

……………………………………………………………………
我今天也遇见了这个问题,手动添加上了。
有一定概率出现。

@yanglebupt
Copy link

似乎 config/config..ts 和 .umirc..ts 不可以混用,要么全部用 config 的形式,要么全用 .umirc

@overcastsky
Copy link
Author

overcastsky commented Jul 18, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants