[英]Error: Couldn't find preset “es2015” relative to directory
我正在編寫一個項目,並且已經編寫了另一個我需要作為節點模塊的項目
我已經將npm模塊鏈接在一起,並且我導入了npm模塊,如下所示:
const rh = require('richs-helpers');
當我運行npm run watch
時,我在projectA中出現標題錯誤
import React from 'react';
import ReactDOM from 'react-dom';
import rh from 'richs-helpers';
export default class QuizApp extends React.Component {
render() {
return <div></div>
}
}
我的.babelrc看起來像這樣:
{
"sourceMaps": true,
"ignore": "/node_modules",
"presets": ["es2015", "react", "stage-2"]
}
這是一個簡單的反應應用程序,只需要我的節點模塊,所以我無法理解錯誤
我也嘗試過要求我的模塊而不是導入
也:
如何清除此錯誤?
您是否使用“ npm install --save-dev babel-preset-es2015”安裝es2015? 您也可以嘗試刪除“ node_modules /”文件夾,然后再次運行“ npm install”(如果安裝時發生問題),請在此處查看: http : //babeljs.io/docs/plugins/preset-es2015/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.