I’m having trouble when I attempt to install a package named moment-timezone for my Node.js project. Each time I try to execute the installation command, I receive an error message that reads:
[email protected] install /home/user/project/node_modules/moment-timezone
node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! System Linux 4.15.0-desktop-amd64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/user/project/node_modules/moment-timezone
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I am using Ubuntu, and I believe this issue may be due to missing development tools. Has anyone faced a similar problem, and can you suggest a solution?
yeah, this happens a lot on linux. just install the make command with sudo apt install make gcc g++ or go for the build-essential package for everything you need. should solve your issue real quick!
This error got me too when I first moved to Ubuntu for dev work. node-gyp needs native compilation tools that Linux doesn’t include by default. Installing build-essential helps, but Python version matters too - node-gyp gets finicky about 2.7 vs 3.x depending on your setup. Run sudo apt install build-essential python3-dev first, then nuke your node_modules folder completely and do a fresh npm install. Half-failed installs leave corrupted files that’ll keep breaking things even after you fix the build tools. If you keep hitting these compilation issues, look for pure JavaScript alternatives that skip native dependencies entirely.
Had this exact problem on a fresh Ubuntu install last year. node-gyp needs build-essential package (includes make and other compilation tools). Fixed it with sudo apt update && sudo apt install build-essential. You might need python3-dev too if you get python errors later. JavaScript libraries with native dependencies need these build tools - it’s annoying but that’s how it works. After installing build-essential, clear your npm cache with npm cache clean --force then try installing again. moment-timezone should work fine once you’ve got the build tools set up.