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

child_process 子进程的 env 的值 #140

Open
lovelmh13 opened this issue Jul 26, 2021 · 0 comments
Open

child_process 子进程的 env 的值 #140

lovelmh13 opened this issue Jul 26, 2021 · 0 comments

Comments

@lovelmh13
Copy link
Owner

child_process.spawn 和 child_process.exec

自进程里有个 env,这个参数就是被执行命令所能访问到的环境变量。

这里面的 env 参数,但是指定是不行的,需要 { ...process.env, 'NODE_ENV': 'xxxx'}, 才行,如果不合并 process.env,env 是不完整的,所以会报错。

**注意:**如果使用子进程来对 vue-cli 的项目进行 build 等操作,一定要注意 env 里的 NODE_ENV,是否与项目当前环境需要的环境变量一致。

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

1 participant