>> npm run-script build
无法编译
成功编译,build文件夹包含一个缩小的项目,输出无错误
输出给出以下错误:
react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to minify the bundle. Error: static/js/main.e3925110.chunk.js from Terser
Name expected [static/js/main.e3925110.chunk.js:186,5]
at compiler.run (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\react-scripts\scripts\build.js:176:23)
at finalCallback (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compiler.js:257:39)
at hooks.done.callAsync.err (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compiler.js:273:13)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\Hook.js:154:20)
at onCompiled (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compiler.js:271:21)
at hooks.afterCompile.callAsync.err (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compiler.js:671:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\Hook.js:154:20)
at compilation.seal.err (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compiler.js:668:31)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\Hook.js:154:20)
at hooks.optimizeAssets.callAsync.err (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compilation.js:1385:35)
at AsyncSeriesHook.lazyCompileHook (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\tapable\lib\Hook.js:154:20)
at hooks.optimizeChunkAssets.callAsync.err (C:\Users\Zackyy\Desktop\ReactCoding\wanawiipuri\node_modules\webpack\lib\Compilation.js:1376:32)
Read more here: *removed*
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wanawiipuri@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wanawiipuri@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\Zackyy\AppData\Roaming\npm-cache\_logs\2019-09-20T15_06_48_248Z-debug.log
Stackoverflow社区对此有一些解决方案。第一个是npm i react-scripts --save-dev
,没有任何区别。
其次是npm i terser@3.14.1 --save
,也没有进展。
{
"name": "wanawiipuri",
"version": "0.1.0",
"private": true,
"dependencies": {
"firebase": "^6.6.1",
"firebase-admin": "^8.6.0",
"firebase-redux": "0.0.5",
"firebase-tools": "^7.3.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-redux": "^7.1.1",
"react-redux-firebase": "^2.4.1",
"react-router-dom": "^5.0.1",
"redux": "^4.0.4",
"redux-firestore": "^0.9.0",
"redux-thunk": "^2.3.0",
"universal-cookie": "^4.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"react-scripts": "^3.1.2",
"terser": "^3.14.1"
}
}
使用npx create-react-app
创建的项目。 /
Windows 10 1903,/
VSCode /
ReactJS库/
Firebase托管/ firestore已初始化/
我正在使用npm,而且我不知道基于纱线的可能的修复方法是否可以执行任何操作。即使我尝试了,到目前为止也没有任何效果。
**编辑: 还尝试完全删除terser并安装Terser@3.14.1,然后再删除并安装Terser@3.16.1来测试是否有任何版本可以工作。版本之间没有差异。 还尝试将terser安装为3.14.1和3.16.1的依赖项。什么都没有。
仅此项目无法构建。旧项目成功建立。目前正试图找出可能是什么原因造成的。
答案 0 :(得分:1)
我不知道怎么做,为什么不知道,但是以下解决方案对我有用。 我有这个index.js文件,其中包含将firebase与我的React连接的代码。有这行:
import { env } from './.env';
稍后用于
ReactDOM.render(<Provider store={store}><App env={env} /></Provider>, document.getElementById('root'));
所以我所做的只是注释了导入行和env={env}
部分。没有想法为什么它有用,也将来我是否需要它,但这为我解决了这个问题。
答案 1 :(得分:0)
This should be resolved in terser v3.16.1
-尝试更新import pandas as pd
df = pd.read_csv(text.txt", names=['FirstNames'])
df
df['FirstLetter'] = df['FirstNames'].str[:1]
df
df['FirstLetter'] = df['FirstLetter'].str.lower()
df
df['FirstLetter'].value_counts()
df
df2 = df['FirstLetter'].index.value_counts()
df2
的devDependency,就像您在Out[72]:
2047 1
4647 1
541 1
4639 1
2592 1
545 1
4643 1
2596 1
549 1
2600 1
2612 1
553 1
4651 1
2604 1
557 1
4655 1
2608 1
561 1
2588 1
4635 1
..
`````````
How can I fix this?
一样。