【问题标题】:How do I deploy an updates project and publish on github?如何部署更新项目并在 github 上发布?
【发布时间】:2020-10-04 10:35:26
【问题描述】:

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

虽然 gh-pages 分支已更新为新代码,但仍显示旧代码。

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

仍然无法让它在我的 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.

【问题讨论】:

    标签: reactjs git github deployment branch


    【解决方案1】:

    假设您的package.json 中有一个deploy 脚本,要成功执行它,您必须输入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

    【讨论】:

    • 嘿,我真的很感谢您的评论,但我没有看到您写的任何内容与我的代码相关。我有“部署”:“gh-pages -b master -d build”,
    • 代码只是一个示例 package.json。我的意思是证明您必须使用 npm run deploy 而不是 npm deploy 运行脚本
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-16
    相关资源
    最近更新 更多