Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yarn installation problem with optional dependencies with Next.js and React

I'm using yarn install, but I have a problem called

gyp-error

Im not using python in my proyect.

im also have another subfolder for google-vision

this is my problem:

yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
warning firebase-tools > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning firebase-tools > request > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning firebase-tools > request > [email protected]: this library is no longer supported
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @chakra-ui/[email protected]" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
warning "@chakra-ui/icons > @chakra-ui/[email protected]" has unmet peer dependency "@chakra-ui/system@>=2.0.0".   
warning " > @firebase/[email protected]" has unmet peer dependency "@firebase/[email protected]".
warning " > [email protected]" has unmet peer dependency "jspdf@^2.5.1".
warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
[-/6] ⠠ waiting...
[-/6] ⠠ waiting...
[-/6] ⠐ waiting...
[4/6] ⠐ re2
warning Error running install script for optional dependency: "C:\\Users\...\node_modules\\re2: Command failed.
Exit code: 1
Command: install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR --skip-path-var 
RE2_DOWNLOAD_SKIP_PATH --skip-ver-var RE2_DOWNLOAD_SKIP_VER || npm run rebuild
Arguments:
Directory: C:...node_modules\\re2
Output:
Trying https://github.com/uhop/node-re2/releases/download/1.19.1/win32-x64-108.br ...
Writing to build/Release/re2.node ...
The verification has failed: building from sources ...
Building locally ...

> [email protected] rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python39\\python.exe
gyp ERR! find Python - ...\\Programs\\Python\\Python39\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python39\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python39\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python39-32\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python39-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python39-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python39-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python39-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python39-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python38\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python38\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python38-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python38-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python38-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python38-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python37\\python.exe
gyp ERR! find Python - \"C...\\Python\\Python37\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python37\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python37\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:...\\Local\\Programs\\Python\\Python37-32\\python.exe
gyp ERR! find Python - ...\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python37-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python37-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python37-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python37-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python36\\python.exe
gyp ERR! find Python - \"C:...\Local\\Programs\\Python\\Python36\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python36\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python36\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe
gyp ERR! find Python - \"C:...\\Local\\Programs\\Python\\Python36-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python36-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python36-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python36-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python36-32\\python.exe\" could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python 3
gyp ERR! find Python - \"py.exe\" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"C:\\Path\\To\\python.exe\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"C:\\Path\\To\\python.exe\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:228:18)
gyp ERR! stack     at PythonFinder.execFileCallback (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:427:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
gyp ERR! stack     at ChildProcess.emit (node:events:512:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:483:16)
gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command \"C:\\\\Users\\\\Programacion\\\\node_modules\\\\node\\\\bin\\\\node.exe\" \"C:\\...\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"rebuild\"
gyp ERR! cwd C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\re2
gyp ERR! node -v v19.6.1
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason \"1\".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.16.1

> [email protected] rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:...\\Local\\Programs\\Python\\Python39\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python39\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python39\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python39\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python39-32\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python39-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python39-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python39-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python39-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python39-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38\\python.exe
gyp ERR! find Python - \"C:\...\Programs\\Python\\Python38\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python38\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python38\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python38-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python38-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python38-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python38-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python37\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python37\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python37\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python37\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python37-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python37-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python37-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python37-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python36\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python36\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python36\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python36\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe
gyp ERR! find Python - \"C:\\Users\\Programacion\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files\\Python36-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files\\Python36-32\\python.exe\" could not be run
gyp ERR! find Python checking if Python is C:\\Program Files (x86)\\Python36-32\\python.exe
gyp ERR! find Python - \"C:\\Program Files (x86)\\Python36-32\\python.exe\" could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python 3
gyp ERR! find Python - \"py.exe\" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"C:\\Path\\To\\python.exe\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"C:\\Path\\To\\python.exe\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:228:18)
gyp ERR! stack     at PythonFinder.execFileCallback (C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\lib\\find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:427:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)
gyp ERR! stack     at ChildProcess.emit (node:events:512:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:483:16)
gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command \"C:\\\\Users\\\\Programacion\\\\node_modules\\\\node\\\\bin\\\\node.exe\" \"C:\\\\Users\\\\Programacion\\\\Documents\\\\GitHub\\\\main-Rotam\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"rebuild\"
gyp ERR! cwd C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\re2
success Saved lockfile.
Done in 206.55s.


but with npm everithing is fine,

$ npm install
...
added 1273 packages, and audited 1274 packages in 2m

140 packages are looking for funding
  run `npm fund` for details

20 vulnerabilities (16 moderate, 3 high, 1 critical)

this is my package.json

  "name": "rotam",
  "version": "0.2.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@chakra-ui/icons": "^2.0.14",
    "@chakra-ui/react": "^2.3.4",
    "@emotion/react": "^11.10.4",
    "@emotion/styled": "^11.10.4",
    "@firebase/firestore": "^3.10.0",
    "@fontsource/montserrat": "^4.5.13",
    "@fontsource/plus-jakarta-sans": "^4.5.11",
    "@react-pdf/renderer": "^3.1.9",
    "@stripe/firestore-stripe-payments": "^0.0.6",
    "@stripe/react-stripe-js": "^2.1.0",
    "@stripe/stripe-js": "^1.52.0",
    "axios": "^1.3.4",
    "browser-process-hrtime": "^1.0.0",
    "date-fns": "^2.30.0",
    "ethers": "^6.6.2",
    "firebase": "^9.15.0",
    "firebase-tools": "^11.25.1",
    "framer-motion": "^7.4.0",
    "html2pdf.js": "^0.10.1",
    "jquery": "^3.7.0",
    "jspdf-autotable": "^3.5.28",
    "next": "^13.2.4",
    "node-fetch": "^3.3.1",
    "openai": "^3.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-hooks": "^1.0.1",
    "react-slick": "^0.29.0",
    "stripe": "^11.16.0",
    "swiper": "^9.2.4"
  },
  "devDependencies": {
    "eslint": "8.24.0",
    "eslint-config-next": "12.3.1",
    "eslint-config-prettier": "^8.5.0"
  }
}

Also im using node 18, and yarn 1.22.19,

I've clean cache, delete node modules, delete yarn lock, and reinstall the proyect, also try yarn upgrade, but same problem

like image 374
lawyerWario Avatar asked Sep 17 '25 14:09

lawyerWario


1 Answers

The optional dependencies are not required for the project to run, and they are only used for some specific features that may not be supported on some platforms. You can use the --ignore-optional flag when running yarn install to skip installing the optional dependencies.

For example:

yarn install --ignore-optional

If the issue persists, you can try this:

The optional dependencies are related to image optimization, which is a feature of Next.js that allows resizing and optimizing images on the fly. The optional dependencies are only needed if you want to use a custom image loader, and they can use the default image loader without them. You can use the --ignore-platform flag when running yarn install to ignore the platform compatibility check for the optional dependencies.

For example:

yarn install --ignore-platform
like image 127
Pluto Avatar answered Sep 20 '25 04:09

Pluto