我们遇到了升级到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
在日志文件中:
npm:6.4.1 节点:8.12.0 Windows 10(也可在Docker节点上重现:8.12.0)4092 http fetch GET 404 https://registry.npmjs.org/@xtuc%2flong 426ms @ xtuc / long @ 4.2.1的4093 silly fetchPackageMetaData错误404不 找到:@ xtuc / long @ 4.2.1 4094详细堆栈RangeError:最大调用 堆栈大小超出
这是带有较旧的react-scripts的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
均失败。
任何帮助将不胜感激。