我正在尝试使用gh-pages部署一个react应用程序,构建成功生成,但在部署的那一刻,我得到了这个错误:
> reactapp@0.1.0 deploy C:\Users\javier\Desktop\Code\React1.0\1.1\CV19\reactapp
> gh-pages -d build
warning: failed to remove node_modules/jest-environment-jsdom-fourteen/node_modules/jsdom/lib/jsdom/living/constraint-validation/DefaultConstraintValidation-impl.js: Filename too long
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR!reactapp@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.我的package.json:
{
"homepage ": "http://javier.github.io/reactapp",
"name": "reactapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@reduxjs/toolkit": "^1.4.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.21.0",
"gh-pages": "^2.0.1",
"mapbox-gl": "^1.12.0",
"react": "^16.13.1",
"react-bootstrap-icons": "^1.0.0",
"react-dom": "^16.13.1",
"react-map-gl": "^5.2.8",
"react-mapbox-gl": "^5.0.0",
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.0",
"redux": "^4.0.5"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},有人知道什么会导致这个错误吗?
发布于 2020-11-16 05:54:22
这是由Windows本身造成的。
在Windows文件命名系统中,名称或路径的总长度不能超过259个字符。这包括文件夹路径、文件名和文件扩展名。如果是这样,那么当您尝试删除或移动它时,您将收到此错误。
我已通过重命名受影响的文件夹或文件修复了此问题。在您的例子中,文件位于node_modules文件夹中,这使得它更难处理。
我建议将应用程序移动到顶层文件夹,而不是桌面上的嵌套文件夹。
编辑:微软的帮助论坛上有a similar question,可能会对你有所帮助。
https://stackoverflow.com/questions/64850077
复制相似问题