npm list --depth=0) -- 5.0.4node -v): -- 13.12.0npm -v): -- I use yarn 1.22.4Today I was trying to run a build locally yarn dev and I kept getting the following:
RangeError: Maximum call stack size exceeded
The full output is below I just want to put the main error here. I've removed my node_modules folder, my yarn.lock file, cleaned the cache and reinstalled...4 to 6 times and I still get the error. Only thing I haven't done at this point is just tried restarting my computer...which I'm going to do as soon as I stop writing this.
I was attempting to install dotenv when I got the error, I assumed it had something to do with that, but once I removed it the error persisted. I have deleted all my folders and such too but the error persists.
I've boiled this down to the smallest bit of code I could get to run and throw the error. I've also tried installing the beta version of webpack and webpack-cli and I still got the error.
My webpack.mix.js file:
const mix = require('laravel-mix');
mix
.sass('resources/css/app.scss', 'public/assets/css');
My package.json file:
{
"private": true,
"scripts": {
"dev": "yarn run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "yarn run development -- --watch",
"watch-poll": "yarn run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "yarn run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"cross-env": "^7.0.2",
"laravel-mix": "^5.0.4",
"resolve-url-loader": "^3.1.1",
"sass": "^1.26.3",
"sass-loader": "^8.0.2"
},
"version": "0.0.1"
}
run yarn run dev or just yarn dev
Here's the full error dump:
/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/webpack-cli/bin/cli.js:93
throw err;
^
RangeError: Maximum call stack size exceeded
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:11:22
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
at /Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:14:18
at Array.forEach (<anonymous>)
at interpolate (/Users/joecianflone/Sites/PROJECTS/rebase/node_modules/dotenv-expand/lib/main.js:7:13)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Also just tried clearing everything out again and doing the install and run via npm same issue
Feels like that one of the dotenv dependency: dotenv-expand is the culprit. dotenv-expand contains recursive calls in its main logic, which means if some environment variables have potential self-reference problems, that could cause the dotenv-expand package to overflow nodejs runtime's call stacks.
@Chopinsky Thanks! I had typo'ed something in my .env file and that was the issue.
@Chopinsky Thanks! I had typo'ed something in my
.envfile and that was the issue.
Yep, checking the .env file solved the issue
Most helpful comment
Feels like that one of the
dotenvdependency:dotenv-expandis the culprit.dotenv-expandcontains recursive calls in its main logic, which means if some environment variables have potential self-reference problems, that could cause thedotenv-expandpackage to overflownodejsruntime's call stacks.