已经安装过babel和presets-es2015
package.json中都有相应依赖
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-preset-es2015": "^6.24.1",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2"
}
}
gulpfile.js
var gulp = require("gulp");
var babel = require("gulp-babel");
gulp.task("es5", function() {
return gulp.src("es5/test.js")
.pipe(babel({
presets: ["es2015"]
}))
.pipe(gulp.dest("es6"));
});
目录结构:
运行起来就报错:Error: Couldn't find preset "es2015" relative to directory "C:UsersLiDesktop"
用:presets: ['es2015'].map(require.resolve)报:Error: Cannot find module 'es2015'
但是我都安装了呀,package.json里面也都有显示