![](/img/trans.png)
[英]Serving a create-react-app with Flask "Uncaught SyntaxError: Unexpected token <"
[英]Create React App SyntaxError: Unexpected Token
我正在学习教程,但我无法启动 create-react-app,因为它一直遇到此语法错误。 我正在使用节点 v8.1.4 和 npm v6.14.5。 以下是我的代码。 不知道错误是什么。
yeryndo@Yeryn:/mnt/c/Users/yeryn/desktop/Exercise Files/ch02/02_02/start$ create-react-app react-is-fun
/usr/local/lib/node_modules/create-react-app/node_modules/chalk/source/index.js:103
...styles,
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/create-react-app/createReactApp.js:37:15)
问题是由chalk
库中的此 function 调用引起的:
const proto = Object.defineProperties(() => {}, {
...styles,
level: {
// omitted
}
}
根据MDN ,自 Node.js 8.3.0 (8.0.0 运行时使用--harmony
标志)以来,支持 object 文字中的传播语法(如...styles
中使用的)
由于您使用的是 8.1.4 版本,因此您有两个基本选项:
--harmony
运行 Node.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.