0

I'm getting an error when I run npm install -g aws-cdk it says Maximum call stack size exceeded if I don't do the global install then I don't get that error but my windows machine doesn't pick up that I have AWS-CDK installed then. The documentation also says to install globally.

Has anyone encountered this?

An important note I am using a company PC that sits behind a VPN. I can't however disconnect this from the VPN.

I'm running version 16.18.0 node and version 8.19.2 of npm

The log file where the error is:

37 verbose stack     at resolve (node:path:158:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:21:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)
37 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\realpath.js:41:10)```

2 Answers2

0

This may be related to something in your global node_modules directory and not the AWS CDK. Try some answers to this question first.

perpil
  • 1,521
  • 7
  • 5
  • I tried all of those solutions and nothing got it working. Is there maybe a hacky way I can install it? Like I said the non global install works but not the global one – Andrew Knoesen Oct 20 '22 at 17:08
0

I had the same issue. My problem is that I work on a PC with roaming profiles where APPDATA is redirected to a server share. In my case changing the npm prefix directory solved the issue. Try the following:

npm config --global get prefix

In my case the output was: \\SRV02\Profiles\USERNAME_HERE\AppData\Roaming\npm

I changed it using the following command

npm config --global set prefix C:\tools\npm-prefix

then everything works. Remember to add C:\tools\npm-prefix to the PATH environment variable

Michael Mairegger
  • 6,833
  • 28
  • 41