我试图用gh-pages部署我的React应用程序,但是我遇到了这个错误:“ file”参数必须是字符串类型。收到的类型未定义。
起初,我以为是我的代码,所以我做了一个没有任何修改的create-react-app,试图用npm run deploy命令进行部署,但又收到了此错误消息。
我的package.json(我已经添加了homepage链接,predeploy和deploy脚本以及gh-pages依赖项):
"name": "test-deploy",
"version": "0.1.0",
"private": true,
"homepage": "https://vnsteven.github.io/test-deploy/",
"dependencies": {
"gh-pages": "^2.1.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version", …Run Code Online (Sandbox Code Playgroud)