每次我尝试像往常一样使用“yarn start”启动项目时,都会收到“命令失败,退出代码 127”错误。我意识到,一旦我将 iOS 更新到 Monterey v12.6.1 ,我就开始收到此错误。我的节点版本似乎与纱线不兼容。
我尝试过什么来解决这个问题:
我尝试过的一切都失败了。
这是纱线错误日志:
Yarn version:
1.22.10
Node version:
15.7.0
Platform:
darwin x64
Trace:
Error: getaddrinfo ENOTFOUND registry.yarnpkg.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:69:26)
npm manifest:
{
"name": "web",
"version": "0.1.0",
"homepage": "https://danibis.github.io/",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"cors": "^2.8.5",
"express": "^4.17.2",
"focus-trap-react": "^8.9.1",
"leaflet": "^1.8.0",
"node-sass": "^6.0.1",
"nodemailer": "^6.7.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-leaflet": "^4.0.0",
"react-scripts": "4.0.3",
"styled-components": "^5.3.3",
"web-vitals": "^1.0.1",
"webpack-hot-middleware": "^2.25.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "yarn run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
]
}
yarn manifest:
No manifest
Lockfile:
No lockfile
任何其他想法如何解决这个问题将不胜感激。
感谢您的宝贵时间!
我找到了解决方案:
使用nvm将npm的版本切换到最新(当时是19.0.0)并运行“yarn install”。这解决了问题!
我通过重新安装纱线解决了这个问题。