Yarn安装问题与Next.js和React的可选依赖关系

huangapple go评论60阅读模式
英文:

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

问题

I'm using yarn install, but I have a problem called "gyp-error." I'm not using Python in my project. I 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 > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning firebase-tools > request > uuid@3.4.0: 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 > har-validator@5.1.5: this library is no longer supported
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "> @chakra-ui/icons@2.0.19" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
warning "@chakra-ui/icons > @chakra-ui/icon@3.0.16" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
warning "> @firebase/firestore@3.13.0" has unmet peer dependency "@firebase/app@0.x".
warning "> jspdf-autotable@3.5.29" has unmet peer dependency "jspdf@^2.5.1".
warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" 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 ...

> re2@1.19.1 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@19.6.1 | win32 | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from the command line or npm configuration
gyp ERR! find Python Python is not set from the 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 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
...

But with npm, everything 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.

<details>
<summary>英文:</summary>

I&#39;m using `yarn install`, but I have a problem called 

&gt; 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 > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning firebase-tools > request > uuid@3.4.0: 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 > har-validator@5.1.5: this library is no longer supported
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @chakra-ui/icons@2.0.19" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
warning "@chakra-ui/icons > @chakra-ui/icon@3.0.16" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
warning " > @firebase/firestore@3.13.0" has unmet peer dependency "@firebase/app@0.x".
warning " > jspdf-autotable@3.5.29" has unmet peer dependency "jspdf@^2.5.1".
warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" 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 ...

> re2@1.19.1 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@19.6.1 | 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 &quot;python3&quot; can be used
gyp ERR! find Python - &quot;python3&quot; is not in PATH or produced an error
gyp ERR! find Python checking if &quot;python&quot; can be used
gyp ERR! find Python - &quot;python&quot; 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&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python39\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python39-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python39-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python39-32\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python38\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python38\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python38-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python38-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python38-32\python.exe&quot; 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 - &quot;C...\Python\Python37\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python37\python.exe&quot; 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&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python37-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python37-32\python.exe&quot; 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 - &quot;C:...\Local\Programs\Python\Python36\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python36\python.exe&quot; 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 - &quot;C:...\Local\Programs\Python\Python36-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python36-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python36-32\python.exe&quot; could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python 3
gyp ERR! find Python - &quot;py.exe&quot; 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=&quot;C:\Path\To\python.exe&quot;
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 &quot;C:\Path\To\python.exe&quot;
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 &quot;C:\\Users\\Programacion\\node_modules\\node\\bin\\node.exe&quot; &quot;C:\...\node_modules\\node-gyp\\bin\\node-gyp.js&quot; &quot;rebuild&quot;
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 &quot;1&quot;.] {
code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.16.1

> re2@1.19.1 rebuild
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@19.6.1 | 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 &quot;python3&quot; can be used
gyp ERR! find Python - &quot;python3&quot; is not in PATH or produced an error
gyp ERR! find Python checking if &quot;python&quot; can be used
gyp ERR! find Python - &quot;python&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python39\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python39\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python39-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python39-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python39-32\python.exe&quot; 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 - &quot;C:...\Programs\Python\Python38\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python38\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python38-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python38-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python38-32\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python37\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python37\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python37-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python37-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python37-32\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python36\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python36\python.exe&quot; 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 - &quot;C:\Users\Programacion\AppData\Local\Programs\Python\Python36-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files\Python36-32\python.exe&quot; could not be run
gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
gyp ERR! find Python - &quot;C:\Program Files (x86)\Python36-32\python.exe&quot; could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python 3
gyp ERR! find Python - &quot;py.exe&quot; 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=&quot;C:\Path\To\python.exe&quot;
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 &quot;C:\Path\To\python.exe&quot;
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 &quot;C:\\Users\\Programacion\\node_modules\\node\\bin\\node.exe&quot; &quot;C:\\Users\\Programacion\\Documents\\GitHub\\main-Rotam\\node_modules\\node-gyp\\bin\\node-gyp.js&quot; &quot;rebuild&quot;
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&#39;ve clean cache, delete node modules, delete yarn lock, and reinstall the proyect,
also try yarn upgrade, but same problem 
</details>
# 答案1
**得分**: 3
可选依赖项不是项目运行所必需的,它们仅用于一些特定功能,这些功能可能不受某些平台支持。在运行 `yarn install` 时,您可以使用 `--ignore-optional` 标志跳过安装可选依赖项。
例如:

yarn install --ignore-optional


如果问题仍然存在,您可以尝试以下方法:
可选依赖项与图像优化有关,这是 `Next.js` 的一个功能,允许在需要时调整大小和优化图像。只有在您想使用自定义图像加载程序时才需要可选依赖项,否则可以使用默认的图像加载程序。在运行 `yarn install` 时,您可以使用 `--ignore-platform` 标志来忽略对可选依赖项的平台兼容性检查。
例如:

yarn install --ignore-platform


<details>
<summary>英文:</summary>
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
</details>

huangapple
  • 本文由 发表于 2023年7月7日 06:50:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76632962.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定