ich Babel vor Ort in meinem Projekt mit dem folgenden Befehl installiert:Babel nicht funktioniert, gibt CLI Fehler
npm install babel-cli babel-core babel-preset-es2015 --save-dev
Das gibt mir die folgende Ausgabe in package.json:
{
"name": "my_project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "babel src -d lib"
},
"scripts": {
"build": "babel --presets es2015 src -d lib"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-loader": "^6.2.8",
"babel-preset-es2015": "^6.18.0",
"webpack": "^1.13.3"
},
"dependencies": {
"lodash": "^4.17.2"
}
}
I bin mir nicht sicher, aber es sieht so aus, als ob es erfolgreich installiert wurde. Aber wenn ich versuche npm run babel
zu laufen erhalte ich:
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "babel"
npm ERR! node v7.0.0
npm ERR! npm v4.0.2
npm ERR! missing script: babel
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
nam ERR! /Path/To/My/Project/npm-debug.log
Warum nicht Babel arbeiten? In der package.json-Datei ist enthalten:
Haben Sie es in Ihrer Webpack-Konfiguration definiert? – Pineda
Mögliches Duplikat von [Webpack beginnt, Importfehler] (http://stackoverflow.com/questions/40775977/webpack-getting-started-import-error) – Pineda
Wenn nicht, lesen Sie die Antwort auf ein (ähnliches Problem) [ http://stackoverflow.com/a/40776313/2902660] – Pineda