Reputation: 350
I am trying to set up a basic node project. I have a fresh install of node (I have tried both Node 12 LTS and Node 13 on separate fresh installs.) When I try and run NPM, I get a heap limit error.
E:\Development\MyProject> npm help install --verbose
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF784B5021F napi_wrap+124591
2: 00007FF784AF0296 v8::base::CPU::has_sse+35542
3: 00007FF784AF0F66 v8::base::CPU::has_sse+38822
4: 00007FF785317E6E v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF7852FF5C1 v8::SharedArrayBuffer::Externalize+785
6: 00007FF7851C690C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
7: 00007FF7851D1C00 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
8: 00007FF7851CE72F v8::internal::Heap::PageFlagsAreConsistent+3151
9: 00007FF7851C3E83 v8::internal::Heap::CollectGarbage+1283
10: 00007FF7851C6A5A v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1770
11: 00007FF7851BCDC3 v8::base::CPU::has_vfp3+467
12: 00007FF784A9F70C v8::internal::wasm::JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit+101820
13: 00007FF784A9E6A1 v8::internal::wasm::JSToWasmWrapperCompilationUnit::~JSToWasmWrapperCompilationUnit+97617
14: 00007FF784B99C5B uv_async_send+331
15: 00007FF784B993FC uv_loop_init+1212
16: 00007FF784B995C4 uv_run+244
17: 00007FF784ABC0F3 v8::internal::interpreter::BytecodeArrayWriter::source_position_table_builder+29635
18: 00007FF784B18080 node::Start+288
19: 00007FF7849D66FC RC4_options+339452
20: 00007FF785817678 v8::internal::SetupIsolateDelegate::SetupHeap+1290008
21: 00007FFD91A67BD4 BaseThreadInitThunk+20
22: 00007FFD9334CED1 RtlUserThreadStart+33
This error occurs regardless of what npm
command I run. I have tried increasing the memory limit using the NODE_OPTIONS
environment variable, but that just makes NPM take longer to consume all the memory before failing.
What am I missing to be able to run NPM?
Current Environment
Windows 10 w/ Powershell
Node v13.2.0
Edit 2
May be worth noting that I have previously had this project and Node running, but had to remove the hard drive Node was installed on due to a drive failure. This is my attempt to put a fresh installation of Node on my machine.
Edit 1
Here is my package.json
, though the error occurs both inside and outside a project.
{
"name": "myProject",
"version": "1.0.0",
"description": "",
"main": "app.jsx",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"wp": "webpack",
"seed-db": "seed --db-name myProject --data ./seeds --drop-collection"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"css-loader": "^1.0.1",
"jquery": "^3.4.0",
"node-sass": "^4.11.0",
"popper.js": "^1.15.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"sass-loader": "^7.1.0",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.17.1",
"webpack-hot-middleware": "^2.24.3"
},
"dependencies": {
"axios": "^0.18.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"mongo-seeding": "^2.2.0",
"mongo-seeding-cli": "^2.2.0",
"npm": "^6.9.0",
"webpack-cli": "^3.3.0"
}
}
Upvotes: 1
Views: 3739
Reputation: 350
After multiple re-installs, I finally found the issue, helped by this SO answer. Per the context of the question, I recently had a drive failure and installed a new hard drive. This new hard drive was given a different name (swtiched from A:
to E:
.) I found an old .npmrc
that I had missed on previous passes that pointed NPM to a missing location on the A:
drive. Once I removed that file, restarted for good measure, and reinstalled Node, I was able to use NPM commands again.
It seems weird to me that this issue caused NPM to silently fail and eat all the memory.
Upvotes: 1
Reputation: 28737
I have to say that this behaviour is odd. Since it is happening for any npm
command you run wherever you run it, it might be that your npm install is just broken. Try re-installing npm
from scratch, after deleting the old version.
Also, try using yarn
, an alternative package manager. It's not ideal, but it might get you further ahead in your project.
Upvotes: 1