I have found the error lies
inside the node modules - both 10.16.0 and 12.6.0 and found a dirty on-site
workaround
The error is because the cache memory size is not working on
large files and typescript is a 7.6MB download which is larger than the 5 MB
cache default cache size that node uses.
To fix on site, I edited one of node modules mentioned in the
cache to larger MAX_MEM_SIZE which allows it to work. Still it is a dirty fix,
so there is still a bug to be fixed by node js.
My dirty fix was to edit inside
…nodejs\node_modules\npm\make-fetch-happen\cache.js - line 12
…nodejs\node_modules\npm\make-fetch-happen\cache.js - line 12
change
const MAX_MEM_SIZE = 5 * 1024 * 1024 // 5MB to become
const MAX_MEM_SIZE = 25 * 1024 * 1024 // 25MB my temp fix to allow large downloads
const MAX_MEM_SIZE = 5 * 1024 * 1024 // 5MB to become
const MAX_MEM_SIZE = 25 * 1024 * 1024 // 25MB my temp fix to allow large downloads
Now npm install typescript will work!!!
Please mark as a answer
Thanks for this solution. its work for me
ReplyDeletethanks you saved me. was having issue while installing gatsby
ReplyDeletegatsby new glue-app https://github.com/gatsbyjs/gatsby-starter-hello-world
The professional fix to this problem
ReplyDeleteCheck your npm version by running : npm -v
once you found the version you running , confirm this version by checking your package.json , and check the engines ... you will see npm and node versions required for the project.
upgrade your npm version to the one that is reflected on the package.json