【发布时间】:2018-12-28 15:40:06
【问题描述】:
我正在尝试撰写这篇文章 a react calculator
我在scripts 中将我的package.json 设置为"start": "babel-node ./server/server.js"。当我运行npm start 时,会出现错误。 yarn start 提供了此处显示的更多详细错误消息。
max@DESKTOP-4J1U771 MINGW64 ~/Documents/react-calculator (master) $ yarn start yarn run v1.7.0 警告 package.json: No license field $ babel-node ./server/server.js C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\logger.js:41 抛出新的构造函数(this._buildMessage(msg)); ^
参考错误:[巴贝尔] C:\Users\max\Documents\react-calculator\server\server.js:未知 选项:base.0。查看 h ttp://babeljs.io/docs/usage/options/ 了解 有关选项的更多信息。
此错误的常见原因是存在配置 没有相应预设名称的选项对象。示例:
无效:
{ presets: [{option: value}] }有效:{ presets: [['presetName', {option: value}]] }有关预设配置的更多详细信息,请参阅 https://babeljs.io/docs/en/plugins#pluginpresets-op 重刑。 在 Logger.error (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\logger.j 年代:41:11) 在 OptionManager.mergeOptions (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation \file\options\option-manager.js:226:20) 在 OptionManager.init (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\op 选项\选项-manager.js:368:12) 在 File.initOptions (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\inde x.js:212:65) 在新文件(C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\file\index.js:135 :24) 在 Pipeline.transform (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\transformation\pipelin e.js:46:16) 在 Object.transformFileSync (C:\Users\max\Documents\react-calculator\node_modules\babel-core\lib\api\node.js:152: 10) 编译时(C:\Users\max\Documents\react-calculator\node_modules\babel-register\lib\node.js:118:20) 在加载程序(C:\Users\max\Documents\react-calculator\node_modules\babel-register\lib\node.js:144:14) 在 Object.require.extensions.(匿名函数) [as .js] (C:\Users\max\Documents\react-calculator\node_modules\ babel-register\lib\node.js:154:7) 错误命令失败,退出代码 1. info 请访问https://yarnpkg.com/en/docs/cli/run 获取有关此> 命令的文档。
有谁知道这里发生了什么以及如何解决它?
【问题讨论】:
-
你能把你的 package.json 和 webpack.config.js 文件贴在这里
标签: node.js reactjs npm babeljs yarnpkg