#reactjs #npm
Вопрос:
Когда я делаю npm run deploy
это в своем приложении React, я получаю следующие сообщения об ошибках:
> keeper-part-3-completed@1.0.0 predeploy /Users/averyyang/Desktop/Web Development/React/keeper
> npm run build
> keeper-part-3-completed@1.0.0 build /Users/averyyang/Desktop/Web Development/React/keeper
> react-scripts build
Creating an optimized production build...
Failed to compile.
Error: html-webpack-plugin could not minify the generated output.
In production mode the html minifcation is enabled by default.
If you are not generating a valid html output please disable it manually.
You can do so by adding the following setting to your HtmlWebpackPlugin config:
|
| minify: false
|
See https://github.com/jantimon/html-webpack-plugin#options for details.
For parser dedicated bugs please create an issue here:
https://danielruf.github.io/html-minifier-terser/
Parse Error: <link font-family: "Montserrat", sans-serif;
href="https://fonts.googleapis.com/css?family=McLaren|Montserratamp;display=swap "
rel="stylesheet" />
<link rel="stylesheet" href="styles.css" />
<link id="external-css" rel="stylesheet" type="text/css" href="https://fonts.g oogleapis.com/css?family=Montserratamp;amp;display=swap" media="all">
</head>
<body>
<div id="root"></div>
<script src="../src/index.js" type="text/jsx"></script>
<script>!function(e){function r(r){for(var n,p,l=r[0],a=r[1],f=r[2],c=0,s=[];c< l.length;c )p=l[c],Object.prototype.hasOwnProperty.call(o,p)amp;amp;o[p]amp;amp;s.push(o[p][ 0]),o[p]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)amp;amp;(e[n]=a[n]);for( iamp;amp;i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(v ar e,r=0;r<u.length;r ){for(var t=u[r],n=!0,l=1;l<t.length;l ){var a=t[l];0!==o [a]amp;amp;(n=!1)}namp;amp;(u.splice(r--,1),e=p(p.s=t[0]))}return e}var n={},o={1:0},u=[];fun ction p(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[ r].call(t.exports,t,t.exports,p),t.l=!0,t.exports}p.m=e,p.c=n,p.d=function(e,r,t) {p.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},p.r=function(e){"und efined"!==typeof Symbolamp;amp;Symbol.toStringTagamp;amp;Object.defineProperty(e,Symbol.toStr ingTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.t=fu nction(e,r){if(1amp;ramp;amp;(e=p(e)),8amp;r)return e;if(4amp;ramp;amp;"object"===typeof eamp;amp;eamp;amp;e.__esM odule)return e;var t=Object.create(null);if(p.r(t),Object.defineProperty(t,"defau lt",{enumerable:!0,value:e}),2amp;ramp;amp;"string"!=typeof e)for(var n in e)p.d(t,n,funct ion(r){return e[r]}.bind(null,n));return t},p.n=function(e){var r=eamp;amp;e.__esModule ?function(){return e.default}:function(){return e};return p.d(r,"a",r),r},p.o=fun ction(e,r){return Object.prototype.hasOwnProperty.call(e,r)},p.p="/keeper/";var l =this["webpackJsonpkeeper-part-3-completed"]=this["webpackJsonpkeeper-part-3-comp leted"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var f=0;f<l.length;f )r(l[ f]);var i=a;t()}([]);
//# sourceMappingURL=runtime-main.9b9671fc.js.map</script><script src="/keeper/st atic/js/2.e4ce1b77.chunk.js"></script><script src="/keeper/static/js/main.ed330a9 2.chunk.js"></script></body>
</html>
- htmlparser.js:244 new HTMLParser
[keeper]/[html-minifier-terser]/src/htmlparser.js:244:13
- htmlminifier.js:993 minify
[keeper]/[html-minifier-terser]/src/htmlminifier.js:993:3
- htmlminifier.js:1354 Object.exports.minify
[keeper]/[html-minifier-terser]/src/htmlminifier.js:1354:16
- index.js:1013 HtmlWebpackPlugin.minifyHtml
[keeper]/[html-webpack-plugin]/index.js:1013:46
- index.js:429 HtmlWebpackPlugin.postProcessHtml
[keeper]/[html-webpack-plugin]/index.js:429:40
- index.js:254
[keeper]/[html-webpack-plugin]/index.js:254:25
- task_queues.js:93 processTicksAndRejections
internal/process/task_queues.js:93:5
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keeper-part-3-completed@1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keeper-part-3-completed@1.0.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! /Users/averyyang/.npm/_logs/2021-05-10T10_18_18_522Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keeper-part-3-completed@1.0.0 predeploy: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keeper-part-3-completed@1.0.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! /Users/averyyang/.npm/_logs/2021-05-10T10_18_18_580Z-debug.log
Полный журнал 2021-05-10T10_18_18_522Z-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@6.14.12
3 info using node@v14.16.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle keeper-part-3-completed@1.0.0~prebuild: keeper-part-3-completed@1.0.0
6 info lifecycle keeper-part-3-completed@1.0.0~build: keeper-part-3-completed@1.0.0
7 verbose lifecycle keeper-part-3-completed@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle keeper-part-3-completed@1.0.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/averyyang/Desktop/Web Development/React/keeper/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/averyyang/Desktop/Web Development/React/keeper/node_modules/.bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle keeper-part-3-completed@1.0.0~build: CWD: /Users/averyyang/Desktop/Web Development/React/keeper
10 silly lifecycle keeper-part-3-completed@1.0.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle keeper-part-3-completed@1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle keeper-part-3-completed@1.0.0~build: Failed to exec build script
13 verbose stack Error: keeper-part-3-completed@1.0.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid keeper-part-3-completed@1.0.0
15 verbose cwd /Users/averyyang/Desktop/Web Development/React/keeper
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v14.16.1
19 verbose npm v6.14.12
20 error code ELIFECYCLE
21 error errno 1
22 error keeper-part-3-completed@1.0.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the keeper-part-3-completed@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The Complete log of 2021-05-10T10_18_18_580Z-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using npm@6.14.12
3 info using node@v14.16.1
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle keeper-part-3-completed@1.0.0~predeploy: keeper-part-3-completed@1.0.0
6 verbose lifecycle keeper-part-3-completed@1.0.0~predeploy: unsafe-perm in lifecycle true
7 verbose lifecycle keeper-part-3-completed@1.0.0~predeploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/averyyang/Desktop/Web Development/React/keeper/node_modules/.bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
8 verbose lifecycle keeper-part-3-completed@1.0.0~predeploy: CWD: /Users/averyyang/Desktop/Web Development/React/keeper
9 silly lifecycle keeper-part-3-completed@1.0.0~predeploy: Args: [ '-c', 'npm run build' ]
10 silly lifecycle keeper-part-3-completed@1.0.0~predeploy: Returned: code: 1 signal: null
11 info lifecycle keeper-part-3-completed@1.0.0~predeploy: Failed to exec predeploy script
12 verbose stack Error: keeper-part-3-completed@1.0.0 predeploy: `npm run build`
12 verbose stack Exit status 1
12 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
12 verbose stack at EventEmitter.emit (events.js:315:20)
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1048:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid keeper-part-3-completed@1.0.0
14 verbose cwd /Users/averyyang/Desktop/Web Development/React/keeper
15 verbose Darwin 19.6.0
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
17 verbose node v14.16.1
18 verbose npm v6.14.12
19 error code ELIFECYCLE
20 error errno 1
21 error keeper-part-3-completed@1.0.0 predeploy: `npm run build`
21 error Exit status 1
22 error Failed at the keeper-part-3-completed@1.0.0 predeploy script.
22 error This is probably not a problem with npm. There is likely additional logging output above.
23 verbose exit [ 1, true ]
I’ve seen many cases like mine, with the same solution:
- remove
package-lock.json
file andnode_modules
folder npm cache clean --force
npm install
I’ve tried the above, but the problem still remains.
What else could I try?
Please tell me if I need to provide any more details. Thank you in advance.