本文介紹了錯(cuò)誤:找不到預(yù)設(shè)“es2015";相對(duì)于目錄“/Users/username"的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問題描述
限時(shí)送ChatGPT賬號(hào)..
嘗試使用 gulp-babel 時(shí)出現(xiàn)以下錯(cuò)誤:
I get the following error when trying to use gulp-babel:
錯(cuò)誤:找不到相對(duì)于目錄的預(yù)設(shè)es2015""/用戶/用戶名"
Error: Couldn't find preset "es2015" relative to directory "/Users/username"
我在全局和本地安裝了 es2015 預(yù)設(shè),所以不明白為什么會(huì)出現(xiàn)問題.
I have the es2015 preset installed globally and locally so can't see why this would be an issue.
下面是我的 gulp 設(shè)置和 package.json.
Below is my gulp set up and package.json.
var babel = require('gulp-babel');
var es2015 = require('babel-preset-es2015');
gulp.task('babel', function() {
return gulp.src('./app/main.js')
.pipe(babel({
presets: [es2015]
}))
.pipe(gulp.dest('dist'));
});
包.json
"devDependencies": {
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-node5": "^1.1.1",
"browser-sync": "^2.11.0",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.1",
"gulp-stylus": "^2.2.0"
}
我正在使用 node v5.1.0 和 babel v6.4.0
I am using node v5.1.0 and babel v6.4.0
這是終端輸出
終端輸出
推薦答案
只需要安裝babel-preset-es2015
:
CLI 使用示例:
npm install babel-cli babel-preset-es2015
這篇關(guān)于錯(cuò)誤:找不到預(yù)設(shè)“es2015";相對(duì)于目錄“/Users/username"的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!