Install sqlite3 for Node.js under Mac M1
Keep trying!
Environment
- Mac M1 Max
- Monterey
- Node v16.15.1
- pnpm v7.3.0
Steps
- First of all
# Don't activate conda !!!
- Install sqlite3
brew install sqlite3
- Export env
export PATH="/opt/homebrew/opt/sqlite/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/sqlite/lib"
export CPPFLAGS="-I/opt/homebrew/opt/sqlite/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/sqlite/lib/pkgconfig"
- Under your project
pnpm add sqlite3
# node_modules/.pnpm/sqlite3@5.0.8/node_modules/sqlite3: Running install script, done in 1m 41s
- Check
node -e "var sqlite3=require('sqlite3'); console.log(sqlite3.VERSION)"
3.38.4