【发布时间】:2019-12-13 17:53:29
【问题描述】:
我使用“create-react-app”命令启动了一个项目,当我执行 npm run 命令时,该命令成功运行,但是当我使用 npm build 命令时,它每次都会失败并出现以下错误。
/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run build --scripts-prepend-node-path=auto
> finteen-web@0.1.0 build /home/jayg/Documents/MyCode/Code/Web/finteen-web
> react-scripts build
Creating an optimized production build...
Failed to compile.
static/js/main.626dbb4b.js from UglifyJs
SyntaxError: Unexpected token: name (length) [/home/jayg/~/punycode/punycode.js:55,0]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! finteen-web@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the finteen-web@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! /home/jayg/.npm/_logs/2019-12-13T17_52_13_422Z-debug.log
Process finished with exit code 1
使用 create-react-app 版本:0.9.5
【问题讨论】:
-
请提及您正在使用的 create-react-app 和 nodejs 和 npm 的版本。对我来说,它使用来自 github 的最新版本构建得很好。日志文件也会很有帮助
/home/jayg/.npm/_logs/2019-12-13T17_52_13_422Z-debug.log -
更新 create-react-app 版本有效