如何部署更新项目并在github上发布?

时间:2020-10-04 10:35:26

标签: reactjs git github deployment branch

这几天我遇到的问题是我无法更新我的 https://filipzafran.github.io/Best-TO-DO-App-in-the-history-of-the-universe/ 网站页面。

尽管gh-pages分支已用新代码更新,但仍显示旧代码。

我有: -删除并再次创建gh页 -推送了新的提交 -重新与主人合并 -清除了浏览器历史记录(捕获) -阅读众多解决方案

仍然无法使其在我的gh-pages网站上发布新代码。 我觉得这可能与脱胶有关。

我是否需要再次部署? 因为当我这样做的时候,从师傅那里,这给了我一个很长的错误:

redux-todo-step_by_step git:(master) npm deploy

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /home/ficho/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.14.7 /home/ficho/.nvm/versions/node/v13.8.0/lib/node_modules/npm

Did you mean this?
    repo

This is my repo

1 个答案:

答案 0 :(得分:0)

假设您的deploy中有一个package.json脚本,要成功执行该脚本,您必须输入npm run deploy,因为deploy本身不是npm命令。 在npm中,run是允许您执行自定义脚本的命令。

这是package.json和相关命令的示例...

{
  "name": "raci-api",
  "version": "0.4.0",
  "description": "raci API",
  "main": "src/server.js",
  "scripts": {
    "start:dev": "nodemon src/server.js -e \"NODE_END=development\"",
    "start:production": "node src/server.js -e \"NODE_ENV=production\"",
    "lint": "eslint src/**/*.js",
    "lint:fix": "eslint --fix src/**/*.js",
    "docs:serve": "npx http-server -c-1 docs -o",
  },
  "author": "",
  "license": "ISC",
  "repository": {
    "type": "git",
    "url": "yourRepoURL"
  },
  "dependencies": {
    "yourDependencies": "here"
  },
  "devDependencies": {
    "yourDevDependencies": "here"
  }
}

在这种情况下,要正确投放应用(例如环回),您必须使用npm run start:dev