1

is there any soluation for this error? I'm receiving that while running npm install on centos 7. npm version = 8.5.0 nodejs version = v16.14.1

receiving error: screenshot

npm ERR! path /usr/share/nginx/html/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/bin/node /usr/share/nginx/html/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/usr/bin/node',
npm ERR! gyp verb cli   '/usr/share/nginx/html/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.14.1 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "/usr/bin/python3" in the PATH
npm ERR! gyp verb `which` failed Error: not found: /usr/bin/python3
npm ERR! gyp verb `which` failed     at /usr/share/nginx/html/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /usr/share/nginx/html/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  /usr/bin/python3 Error: not found: /usr/bin/python3
npm ERR! gyp verb `which` failed     at getNotFoundError (/usr/share/nginx/html/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/usr/share/nginx/html/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at /usr/share/nginx/html/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Can't find Python executable "/usr/bin/python3", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at E (/usr/share/nginx/html/node_modules/which/which.js:80:29)
npm ERR! gyp ERR! System Linux 3.10.0-1160.45.1.el7.x86_64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nginx/html/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /usr/share/nginx/html/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.14.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1
rew dilator
  • 21
  • 1
  • 3

1 Answers1

1

It appears that you have a Node module that depends on Python. As you're on CentOS you'll need to run:

sudo yum update
sudo yum install python3

then run

python3 -V

to verify that Python is installed.

stdunbar
  • 16,263
  • 11
  • 31
  • 53
  • still receiving same error – rew dilator Apr 25 '22 at 00:59
  • python found but not fixed totally, screenshout attached. npm ERR! gyp ERR! cwd /usr/share/nginx/html/node_modules/node-sass npm ERR! gyp ERR! node -v v16.14.1 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok npm ERR! Build failed with error code: 1 – rew dilator Apr 25 '22 at 01:04
  • Can it find `python3` now? – stdunbar Apr 25 '22 at 01:08
  • yep but ... https://ibb.co/CKNJXpz – rew dilator Apr 25 '22 at 01:13
  • Well that's a different error, not the same error. It looks like [this is an issue with Python3](https://stackoverflow.com/questions/54059433/after-npm-install-an-error-about-a-syntax-error-in-python-appears). Now you need a newer Node installation. The one you have is prehistoric in an environment that releases new versions multiple times a month. – stdunbar Apr 25 '22 at 01:32
  • I'm using nodejs v16.14.1 and npm 8.5.0, the latest one. – rew dilator Apr 25 '22 at 01:37
  • Sorry - you said that and I missed it. I'm out of ideas - something in your environment wants Python 2. The syntax error you're now getting is because Python changed significantly between 2 and 3 and now your Node build is broken because of it. You might want to open a new question with your new error. – stdunbar Apr 25 '22 at 01:42