来自使用 React 的 CircleCI 上的 dotenv-expand 的“超出最大调用堆栈大小”

eda*_*t92 9 circleci reactjs

我正在尝试在 CircleCI 上构建一个反应应用程序,直到最近我才遇到问题。现在,每当我尝试npm run build从 circle.yml 执行操作时,都会收到以下错误:

    #!/bin/bash -eo pipefail
npm run build

> jobcatcher-web@0.0.1 build /home/circleci/repo
> react-scripts build

/home/circleci/repo/node_modules/dotenv-expand/lib/main.js:8
      var key = match.replace(/\$|{|}/g, '')
                      ^

RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at /home/circleci/repo/node_modules/dotenv-expand/lib/main.js:8:23
    at Array.forEach (<anonymous>)
    at interpolate (/home/circleci/repo/node_modules/dotenv-expand/lib/main.js:7:13)
    at /home/circleci/repo/node_modules/dotenv-expand/lib/main.js:14:18
    at Array.forEach (<anonymous>)
    at interpolate (/home/circleci/repo/node_modules/dotenv-expand/lib/main.js:7:13)
    at /home/circleci/repo/node_modules/dotenv-expand/lib/main.js:14:18
    at Array.forEach (<anonymous>)
    at interpolate (/home/circleci/repo/node_modules/dotenv-expand/lib/main.js:7:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jobcatcher-web@0.0.1 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the jobcatcher-web@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2018-03-14T20_57_45_719Z-debug.log
Exited with code 1
Run Code Online (Sandbox Code Playgroud)

我已经尝试添加/重新添加 dotenv-expand 依赖项以及我在 CircleCI 上使用的任何环境变量,但没有成功。

有什么建议?谢谢。

eda*_*t92 12

原来我一直在使用相同的名称导入环境变量,例如REACT_APP_API_KEY_GOOGLE_MAPS=${REACT_APP_API_KEY_GOOGLE_MAPS}. 一旦我更改了名称,例如 REACT_APP_API_KEY_GOOGLE_MAPS=${REACT_APP_API_KEY_GOOGLE_MAPS_EXT} 这个问题就解决了!