将 React App 部署到 Git Hub 页面失败
Deploying React App to Git Hub Pages failed
我正在尝试将我的 React 应用程序部署到 github 个页面......
按照教程进行操作并设法使其适用于之前的项目。
当我 运行 npm 运行 deploy 我收到这个错误
任何帮助将不胜感激如何解释此错误
我尝试了在这里找到的不同解决方案,但 none 帮助了
npm 运行 部署
> Neighbourhood-Map-React@0.1.0 predeploy C:\Users\mels_\Documents\Neighbourhood-Map-React
> npm run build
> Neighbourhood-Map-React@0.1.0 build C:\Users\mels_\Documents\Neighbourhood-Map-React
> react-scripts build
Creating an optimized production build...
Failed to compile.
Error: Parse Error: <meta name="viewport" content="width=device-width, initial
-scale=1>
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamental
s/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="/github.io/Neighbourhood-Map-React/manifest.jso n">
<link rel="shortcut icon" href="/github.io/Neighbourhood-Map-React/favicon .ico">
<!--
Notice the use of /github.io/Neighbourhood-Map-React in the tags above.
It will be replaced with the URL of the `public` folder during the build .
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "/github.io/Neighbourhood-Map-Re act/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. -->
<title>React App</title>
<link href="/github.io/Neighbourhood-Map-React/static/css/main.c066d278.css" rel="stylesheet"></head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="text/javascript" src="/github.io/Neighbourhood-Map-React/stati c/js/main.df359430.js"></script></body>
</html>
- htmlparser.js:240 new HTMLParser
[Neighbourhood-Map-React]/[html-minifier]/src/htmlparser.js:240:13
- htmlminifier.js:951 minify
[Neighbourhood-Map-React]/[html-minifier]/src/htmlminifier.js:951:3
- htmlminifier.js:1306 exports.minify
[Neighbourhood-Map-React]/[html-minifier]/src/htmlminifier.js:1306:16
- index.js:296
[Neighbourhood-Map-React]/[html-webpack-plugin]/index.js:296:16
- util.js:16 tryCatcher
[Neighbourhood-Map-React]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:569:18
- promise.js:614 Promise._settlePromise0
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:693:18
- async.js:133 Async._drainQueue
[Neighbourhood-Map-React]/[bluebird]/js/release/async.js:133:16
- async.js:143 Async._drainQueues
[Neighbourhood-Map-React]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues [as _onImmediate]
[Neighbourhood-Map-React]/[bluebird]/js/release/async.js:17:14
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Neighbourhood-Map-React@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Neighbourhood-Map-React@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mels_\AppData\Roaming\npm-cache\_logs18-07-20T13_00_54_457Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Neighbourhood-Map-React@0.1.0 predeploy: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Neighbourhood-Map-React@0.1.0 predeploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mels_\AppData\Roaming\npm-cache\_logs18-07-20T13_00_54_550Z-debug.log
warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory.
正如@Orkhan Jafarov 所指出的,您的脚本因解析错误而失败。您的 meta
标签末尾缺少 "
。
Error: Parse Error: <meta name="viewport" content="width=device-width, initial-scale=1>
在 Git 中使用 HTTPS 时存在一些常见错误。这些错误通常表明您使用的是旧版本的 Git,或者您无权访问存储库。
当提示输入用户名和密码时,请确保您使用的帐户可以访问存储库。
使用 Git for Windows,运行 命令行中的以下内容将存储您的凭据:
$ git config --global credential.helper wincred
这称为打开密码缓存
我正在尝试将我的 React 应用程序部署到 github 个页面......
按照教程进行操作并设法使其适用于之前的项目。 当我 运行 npm 运行 deploy 我收到这个错误 任何帮助将不胜感激如何解释此错误 我尝试了在这里找到的不同解决方案,但 none 帮助了
npm 运行 部署
> Neighbourhood-Map-React@0.1.0 predeploy C:\Users\mels_\Documents\Neighbourhood-Map-React
> npm run build
> Neighbourhood-Map-React@0.1.0 build C:\Users\mels_\Documents\Neighbourhood-Map-React
> react-scripts build
Creating an optimized production build...
Failed to compile.
Error: Parse Error: <meta name="viewport" content="width=device-width, initial
-scale=1>
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamental
s/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="/github.io/Neighbourhood-Map-React/manifest.jso n">
<link rel="shortcut icon" href="/github.io/Neighbourhood-Map-React/favicon .ico">
<!--
Notice the use of /github.io/Neighbourhood-Map-React in the tags above.
It will be replaced with the URL of the `public` folder during the build .
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "/github.io/Neighbourhood-Map-Re act/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. -->
<title>React App</title>
<link href="/github.io/Neighbourhood-Map-React/static/css/main.c066d278.css" rel="stylesheet"></head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="text/javascript" src="/github.io/Neighbourhood-Map-React/stati c/js/main.df359430.js"></script></body>
</html>
- htmlparser.js:240 new HTMLParser
[Neighbourhood-Map-React]/[html-minifier]/src/htmlparser.js:240:13
- htmlminifier.js:951 minify
[Neighbourhood-Map-React]/[html-minifier]/src/htmlminifier.js:951:3
- htmlminifier.js:1306 exports.minify
[Neighbourhood-Map-React]/[html-minifier]/src/htmlminifier.js:1306:16
- index.js:296
[Neighbourhood-Map-React]/[html-webpack-plugin]/index.js:296:16
- util.js:16 tryCatcher
[Neighbourhood-Map-React]/[bluebird]/js/release/util.js:16:23
- promise.js:512 Promise._settlePromiseFromHandler
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:512:31
- promise.js:569 Promise._settlePromise
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:569:18
- promise.js:614 Promise._settlePromise0
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:614:10
- promise.js:693 Promise._settlePromises
[Neighbourhood-Map-React]/[bluebird]/js/release/promise.js:693:18
- async.js:133 Async._drainQueue
[Neighbourhood-Map-React]/[bluebird]/js/release/async.js:133:16
- async.js:143 Async._drainQueues
[Neighbourhood-Map-React]/[bluebird]/js/release/async.js:143:10
- async.js:17 Immediate.Async.drainQueues [as _onImmediate]
[Neighbourhood-Map-React]/[bluebird]/js/release/async.js:17:14
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Neighbourhood-Map-React@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Neighbourhood-Map-React@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mels_\AppData\Roaming\npm-cache\_logs18-07-20T13_00_54_457Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Neighbourhood-Map-React@0.1.0 predeploy: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Neighbourhood-Map-React@0.1.0 predeploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mels_\AppData\Roaming\npm-cache\_logs18-07-20T13_00_54_550Z-debug.log
warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory.
正如@Orkhan Jafarov 所指出的,您的脚本因解析错误而失败。您的 meta
标签末尾缺少 "
。
Error: Parse Error: <meta name="viewport" content="width=device-width, initial-scale=1>
在 Git 中使用 HTTPS 时存在一些常见错误。这些错误通常表明您使用的是旧版本的 Git,或者您无权访问存储库。 当提示输入用户名和密码时,请确保您使用的帐户可以访问存储库。
使用 Git for Windows,运行 命令行中的以下内容将存储您的凭据:
$ git config --global credential.helper wincred
这称为打开密码缓存