Purpose
I want to use mysql2
(npm).
Steps
- Install MySQL by
brew install mysql
, set up to make sure I can login bymysql -r root -p
- Run
npm init
andnpm install mysql2 --save
- Create
index.js
(see below) - Run
node index.js
- See an error below.
Steps (to check whether mysql2
causes the issue)
- Comment out the second line of index.js
- Run
node index.js
- Confirm that Terminal shows "BEFORE" and "AFTER" without an error.
index.js
console.log('BEFORE');
const mysql = require('mysql2');
console.log('AFTER');
Console (error message)
BEFORE
<--- Last few GCs --->
[3203:0x150008000] 34 ms: Scavenge 2.8 (4.6) -> 2.5 (5.3) MB, 0.5 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[3203:0x150008000] 42 ms: Scavenge 3.8 (7.8) -> 3.5 (8.5) MB, 0.3 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
<--- JS stacktrace --->
FATAL ERROR: wasm code commit Allocation failed - process out of memory
1: 0x1040fe9d8 node::Abort() [/Users/{MY_USER_NAME}/.nvm/versions/node/v14.15.5/bin/node]
...
63: 0x10492c1e8 Builtins_JSEntry [/Users/{MY_USER_NAME}/.nvm/versions/node/v14.15.5/bin/node]
64: 0x150008000
zsh: abort node index.js
Environment
- Mackbook Air (M1, 2020)
- macOS: 11.2.2
- node: 14.15.5
- npm: 7.6.1
- mysql2 (npm): 2.2.5
- mysql (brew): Ver 8.0.23 for osx10.16 on x86_64 (Homebrew)