gyp verb check python checking for Python executable "python2" in the PATH
[4/4] ? Building fresh packages... [8/9] ⠂ puppeteer [2/9] ⠂ fsevents [6/9] ⠂ husky [7/9] ⠂ node-sass error /Users/xyz/Documents/src/app/node_modules/node-sass: Command failed. Exit code: 1 Command: node scripts/build.js Arguments: Directory: /Users/xyz/Documents/src/app/node_modules/node-sass Output: Building: /usr/local/bin/node /Users/xyz/Documents/src/app/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli '/usr/local/bin/node', gyp verb cli '/Users/xyz/Documents/src/app/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli 'rebuild', gyp verb cli '--verbose', gyp verb cli '--libsass_ext=', gyp verb cli '--libsass_cflags=', gyp verb cli '--libsass_ldflags=', gyp verb cli '--libsass_library=' gyp verb cli ] gyp info using node-gyp@3.8.0 gyp info using node@16.13.0 | darwin | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "python2" in the PATH
Solution 1 - Update outdated packages that rely on python2
For example node-sass < 6 require python2
You can upgrade to node-sass@6.02 or replace it with sass@latest
You can also do an alias to sass in package.json if nothing else work
Or force the dependencies in package.json
Solution 2 - Install python 2
brew install pyenv
pyenv install 2.7.18
export PATH="$(pyenv root)/shims:${PATH}"
Solution 3 - Upgrade npm
npm install -g npm
Node Version
You may want to upgrade to Node 16 or + for wider support on Mac. Newer Mac ARM chipsets only support Node 16+. If you have Node 16 or + and you get this error, it's because you have npm packages that are too old and need to be updated to a newer version.
If you have an older Mac, Python 2 and c++11 are installed by default and you will need to always add -`std=++14` command line options
Older Mac must use C++14 or beyond
npm install -std=++14 yarn -std=++14
References
https://github.com/nodejs/node-gyp/issues/1977
Recent Comments