我们在升级到 create-react-scripts 2 时遇到问题。
我运行没有问题npx create-react-app
。应用程序已创建并运行良好。
在基于 create-react-app 的应用中,npm i react-scripts@latest
生成:
npm 错误!超过最大调用堆栈大小 npm ERR!可以在以下位置找到此运行的完整日志:npm ERR!
C:\Users\me\AppData\Roaming\npm-cache_logs\2018-10-09T19_27_15_671Z-debug.log
在日志文件中:
4092 http fetch GET 404 https://registry.npmjs.org/@xtuc%2flong 426ms 4093 @xtuc/long@4.2.1 的愚蠢 fetchPackageMetaData 错误 404 未找到:@xtuc/long@4.2.1 4094 详细堆栈 RangeError:超出最大调用堆栈大小
npm:6.4.1 节点:8.12.0 Windows 10(但也可在 Docker 节点:8.12.0 中重现)
这是带有较旧反应脚本的 package.json 可以正常工作:
...
"dependencies": {
"@material-ui/core": "^3.0.2",
"@material-ui/icons": "^3.0.1",
"classnames": "^2.2.6",
"faker": "^4.1.0",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-markdown": "^3.4.1",
"react-router-dom": "^4.3.1",
"react-scripts": "^2.0.4",
"react-syntax-highlighter": "^7.0.4",
"typeface-lato": "^0.0.54"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-react-jsx": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@material-ui/codemod": "^1.1.0",
"@types/webdriverio": "4.8.7",
"babel-plugin-istanbul": "^4.1.6",
"chromedriver": "2.35",
"commander": "^2.15.1",
"copyfiles": "^1.2.0",
"cross-env": "^5.2.0",
"cucumber": "^3.1.0",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.4.0",
"eslint": "^5.5.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-nibble": "^4.2.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^21.22.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-webdriverio": "^1.0.1",
"gherkin-lint": "^2.11.1",
"jest-junit": "^3.7.0",
"markdownlint": "^0.10.0",
"markdownlint-cli": "^0.10.0",
"mkdirp": "^0.5.1",
"prettier-eslint": "^8.8.2",
"prettier-eslint-cli": "^4.7.1",
"react-test-renderer": "^16.4.1",
"replace-in-file": "^3.4.0",
"rimraf": "^2.6.2",
"selenium-webdriver": "3.6",
"should": "^13.1.0",
"wdio-cucumber-framework": "1.0.2",
"wdio-junit-reporter": "^0.4.4",
"wdio-selenium-standalone-service": "0.0.9",
"wdio-spec-reporter": "0.1.2",
"webdriverio": "^4.13.1"
}
}
将 package.json 更改为读取"react-scripts": "^2.0.4"
然后npm i
运行或运行npm i react-scripts@latest
都失败。
任何帮助将不胜感激。