修复 npm/node-gyp Error: not found: make 在 Ubuntu 上

当你运行 npm install 并且它尝试安装像 bcrypt 这样的原生包时,你看到类似这样的错误消息:

error_trace.txt
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:182:21)

你只需安装 GNU Make。在 Ubuntu 上,最简单的方法是运行

install_build_essential.sh
sudo apt install build-essential

这不仅会安装 make,还会安装相关工具如 gcc 和一些标准头文件和工具。


Check out similar posts by category: Linux, NodeJS