首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >npm运行后发生部署错误

npm运行后发生部署错误
EN

Stack Overflow用户
提问于 2017-05-13 02:06:41
回答 3查看 7.4K关注 0票数 3

在npm运行deploy之后,我遇到了类似上面的错误

Repo on Github

我正在尝试将我的react-app部署到Github的gh-pages上(create-react-app)

代码语言:javascript
复制
'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-world-4@0.1.0 deploy: `npm run build&&gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-world-4@0.1.0 deploy script 'npm run build&&gh-page
s -d build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hello-world-4 package
,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build&&gh-pages -d build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hello-world-4
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hello-world-4
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jan\AppData\Roaming\npm-cache\_logs\2017-05-12T17_55_00_56
9Z-debug.log
EN

回答 3

Stack Overflow用户

发布于 2019-07-26 18:42:15

所以我运行这个命令npm install --save gh-pages

如下所示

在此之后,我运行命令npm run deploy

我的代码成功发布,如下所示。

欲了解更多详细信息,只需关注Facebook的链接,如下所示。

(https://facebook.github.io/create-react-app/docs/deployment#github-pages-https-pagesgithubcom)

我希望你的问题能得到解决。如有错误,请回复。

票数 11
EN

Stack Overflow用户

发布于 2020-12-31 21:15:47

请安装gh-pages并准备就绪

要安装

代码语言:javascript
复制
npm install gh-pages

部署

将此内容添加到package.json

代码语言:javascript
复制
"predeploy": "npm run build",
 
"deploy": "gh-pages -d build"

然后是这个

代码语言:javascript
复制
npm run deploy
票数 2
EN

Stack Overflow用户

发布于 2017-05-13 02:18:20

gh Pages代表GitHub pages。这只是一种通过github存储库部署网站的方法。基本上,NPM之所以大喊大叫,是因为当它尝试运行命令deploy时,没有链接或引用行

代码语言:javascript
复制
$npm run build&&gh-pages -d build

您需要确保定义了gh-pages -d build。可以从运行gh-pages --mangh-pages --help开始

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43943999

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档