Nashif Alam
Nashif Alam

Reputation: 41

Amplify cli : npm ERR! Maximum call stack size exceeded

On executing

npm install -g @aws-amplify/cli

It results in

npm ERR! Maximum call stack size exceeded

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Nashif Alam\AppData\Roaming\npm-cache\_logs\2020-04-20T17_44_57_963Z-debug.log

Here is the Log output

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Nashif Alam\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   '@aws-amplify/cli'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 48145273415ef01a
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/@aws-amplify%2fcli 6012ms (from cache)
8 silly pacote tag manifest for @aws-amplify/cli@latest fetched in 6185ms
9 timing stage:loadCurrentTree Completed in 6274ms

//Removed the rest of the log because it seemed useless in this context

916 silly resolveWithNewModule [email protected] checking installable status
917 silly pacote version manifest for [email protected] fetched in 8ms
918 silly resolveWithNewModule [email protected] checking installable status
919 http fetch GET 200 https://registry.npmjs.org/@ardatan%2fgraphql-tools 1713ms
920 http fetch GET 200 https://registry.npmjs.org/@ardatan/graphql-tools/-/graphql-tools-4.1.0.tgz 5735ms
921 silly pacote version manifest for @ardatan/[email protected] fetched in 7453ms
922 silly resolveWithNewModule @ardatan/[email protected] checking installable status
923 silly pacote range manifest for dot-case@^3.0.3 fetched in 2ms
924 silly resolveWithNewModule [email protected] checking installable status
925 silly pacote version manifest for @graphql-toolkit/[email protected] fetched in 5ms
926 silly resolveWithNewModule @graphql-toolkit/[email protected] checking installable status
927 silly fetchPackageMetaData error for [email protected] Response timeout while trying to fetch https://registry.npmjs.org/relay-compiler (over 30000ms)
928 verbose stack RangeError: Maximum call stack size exceeded
928 verbose stack     at RegExp.test (<anonymous>)
928 verbose stack     at isDepOptional (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:428:45)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:437:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
928 verbose stack     at failedDependency (C:\Users\Nashif Alam\AppData\Roaming\npm\node_modules\npm\lib\install\deps.js:453:9)
929 verbose cwd C:\Users\Nashif Alam
930 verbose Windows_NT 10.0.18363
931 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nashif Alam\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@aws-amplify/cli"
932 verbose node v12.16.2
933 verbose npm  v6.14.4
934 error Maximum call stack size exceeded
935 verbose exit [ 1, true ]

npm version is 6.14.4 and node version is v12.16.2

I tried installing node 10, still same errors

Moreover, every time the log is mostly stuck in Response timeout while trying to fetch https://registry.npmjs.org/**Different link everytime**

Upvotes: 3

Views: 1414

Answers (3)

thisismydesign
thisismydesign

Reputation: 25072

For me the log looked like this:

// ... skipping some deprecation warnings

> [email protected] postinstall /root/.nvm/versions/node/v14.10.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-graphql-types-generator/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

sh: 1: node: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/@aws-amplify/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! Maximum call stack size exceeded

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-10T14_10_28_397Z-debug.log

Note sh: 1: node: Permission denied that led me to https://forum.vuejs.org/t/cannot-install-vue-cli-permission-error-in-require-postinstall/82017/7

I had to add --unsafe-perm to the install command and run it as root (I was already root in WSL):

npm install -g --unsafe-perm @aws-amplify/cli

Upvotes: 0

Chaitanya
Chaitanya

Reputation: 729

Using the following command worked for me

npm cache clean --force

Upvotes: 2

Nashif Alam
Nashif Alam

Reputation: 41

I figured out an answer to the problem, which probably lies with Nodejs version 12.16 and many other earlier versions like 5.0 and 10; But using version 13.13 solved the problem and the command run with no issues.

Upvotes: 0

Related Questions