相关疑难解决方法(0)

尝试使用gh-pages部署我的React应用程序,但收到以下错误消息:“ file”参数必须为字符串类型。接收类型未定义

我试图用gh-pages部署我的React应用程序,但是我遇到了这个错误:“ file”参数必须是字符串类型。收到的类型未定义。

起初,我以为是我的代码,所以我做了一个没有任何修改的create-react-app,试图用npm run deploy命令进行部署,但又收到了此错误消息。

我的package.json(我已经添加了homepage链接,predeploydeploy脚本以及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)

javascript github npm github-pages reactjs

15
推荐指数
1
解决办法
1493
查看次数

标签 统计

github ×1

github-pages ×1

javascript ×1

npm ×1

reactjs ×1