'node- my Gulp application not running on mac

I cant npm install my packages anymore even it was working before

2589 error gyp verb check python checking for Python executable "/Users/minafawzy/.pyenv/shims/python" in the PATH
12589 error gyp verb `which` succeeded /Users/minafawzy/.pyenv/shims/python /Users/minafawzy/.pyenv/shims/python
12589 error gyp ERR! configure error
12589 error gyp ERR! stack Error: Command failed: /Users/minafawzy/.pyenv/shims/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
12589 error gyp ERR! stack   File "<string>", line 1
12589 error gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
12589 error gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12589 error gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
12589 error gyp ERR! stack
12589 error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:397:12)
12589 error gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
12589 error gyp ERR! stack     at maybeClose (node:internal/child_process:1062:16)
12589 error gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:448:11)
12589 error gyp ERR! stack     at Socket.emit (node:events:390:28)
12589 error gyp ERR! stack     at Pipe.<anonymous> (node:net:687:12)
12589 error gyp ERR! System Darwin 21.4.0

my packages.json

{
  "name": "",
  "version": "2.0.0",
  "dependencies": {
    "angular-translate": "^2.19.0",
    "angular-translate-loader-static-files": "^2.19.0",
    "core-js": "^3.16.0",
    "html-to-pdf": "^0.1.11",
    "request": "2.72.0",
    "tether": "^1.4.4",
    "tether-shepherd": "^1.8.1"
  },
  "devDependencies": {
    "angular-mocks": "^1.6.0",
    "babel-core": "^6.26.3",
    "babel-eslint": "^8.2.3",
    "babel-plugin-angularjs-annotate": "^0.10.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-3": "^6.24.1",
    "browser-sync": "^2.26.14",
    "chalk": "^4.1.0",
    "del": "~0.1.3",
    "eslint": "^4.19.1",
    "eslint-plugin-angular": "^3.3.0",
    "eslint-plugin-lodash": "^2.7.0",
    "gulp": "^4.0.2",
    "gulp-angular-filesort": "^1.2.1",
    "gulp-angular-templatecache": "^3.0.0",
    "gulp-autoprefixer": "~2.0.0",
    "gulp-babel": "^7.0.1",
    "gulp-consolidate": "~0.1.2",
    "gulp-csso": "^4.0.1",
    "gulp-debug": "^4.0.0",
    "gulp-filter": "^6.0.0",
    "gulp-flatten": "~0.0.4",
    "gulp-gh-pages": "^0.5.4",
    "gulp-html-angular-validate": "^0.2.0",
    "gulp-htmlmin": "^5.0.1",
    "gulp-inject": "^5.0.5",
    "gulp-jshint": "~1.9.0",
    "gulp-load-plugins": "^2.0.6",
    "gulp-protractor": "~4.1.0",
    "gulp-purifycss": "^0.2.0",
    "gulp-rename": "~1.2.0",
    "gulp-replace": "~0.5.0",
    "gulp-rev": "^9.0.0",
    "gulp-rev-rewrite": "^4.0.0",
    "gulp-ruby-sass": "^1.4.0",
    "gulp-sass": "^4.1.0",
    "gulp-size": "^3.0.0",
    "gulp-uglify": "^3.0.2",
    "gulp-useref": "^5.0.0",
    "gulp-watch": "^5.0.1",
    "gutil": "^1.6.4",
    "http-proxy": "^1.18.1",
    "jasmine-core": "2.5.2",
    "jshint-stylish": "~1.0.0",
    "karma": "^6.3.1",
    "karma-babel-preprocessor": "^7.0.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "0.3.8",
    "karma-phantomjs2-launcher": "^0.5.0",
    "karma-spec-reporter": "0.0.26",
    "karma-wiredep": "^1.0.3",
    "main-bower-files": "~2.4.0",
    "moment": "^2.18.1",
    "node-sass": "^4.14.1",
    "protractor": "~5.1.2",
    "require-dir": "~0.3.2",
    "uglify-save-license": "~0.4.1",
    "wiredep": "~2.2.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "init": "npm install",
    "install": "bower install",
    "eslint": "eslint src/app",
    "start": "gulp serve"
  }
}

I am using node 15

my tries

1- I tried to install python version 3 but still not working

2- I delete rm -r node_modules and npm install

any hint on what happing



Solution 1:[1]

I noticed you're using pyenv. I do as well and ran into a similar issue a while ago. For me, it was definitely a python versioning issue.

Setting the python version in that directory via pyenv local solved it for me.

Solution 2:[2]

The issue come from a mismatch of Node-sass with node version

update node-sass to version 5 works fine with Node.Js 16

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matt Rose
Solution 2 Mina Fawzy