我需要使用react-select
:https://github.com/JedWatson/react-select
为此,我需要先在yarn
上安装Ubuntu 14.04
。安装完成后,yarn add react-select
我无法使用webpack
构建我的项目,因为它给了我错误:
> ./views/index.js中的错误
模块构建失败:错误:无法找到预设" es2015"相对于目录" / home / nikita / Desktop / kipnis_prototype / client_side_BrainImmuneConnectome / brain-immune-connectome"
at /home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
在Array.map()
在OptionManager.resolvePresets(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
在OptionManager.mergePresets(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
在OptionManager.mergeOptions(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
在OptionManager.init(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
在File.initOptions(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/index.js:212:65)
在新文件(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/file/index.js:135:24)
在Pipeline.transform(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
在transpile(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-loader/lib/index.js:50:20)
at /home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-loader/lib/fs-cache.js:118:18
在ReadFileContext.callback(/home/nikita/Desktop/kipnis_prototype/client_side_BrainImmuneConnectome/brain-immune-connectome/node_modules/babel-loader/lib/fs-cache.js:31:21)
在FSReqWrap.readFileAfterOpen [as oncomplete](fs.js:437:13)
错误的ERR!代码ELIFECYCLE
错误的ERR!错误2
错误的ERR! brainimmuneconnectome@0.0.0 webpack:webpack
错误的ERR!退出状态2
错误的ERR!
错误的ERR!在brainimmuneconnectome@0.0.0 webpack脚本失败。
错误的ERR!这可能不是npm的问题。上面可能有额外的日志记录输出。
错误的ERR!可以在以下位置找到此运行的完整日志:
错误的ERR! /home/nikita/.npm/_logs/2018-06-07T04_11_30_458Z-debug.log
我在.babelrc
文件中安装了礼物:
{
"presets": ["es2015", "react", "stage-1"]
}
所以,我在这里找到的解决方案:
Error: Couldn't find preset "es2015" relative to directory
无效。这里出了什么问题?怎么可能修好?
答案 0 :(得分:1)
我在这里找到了解决方案:
https://github.com/babel/gulp-babel/issues/93
执行以下操作:
npm i babel-preset-es2015
npm i babel-preset-stage-2
解决了这个问题。