โฟลเดอร์ของฉันคือ src และฉันได้ติดตั้ง babel ผ่าน CLI แล้ว แต่ฉันยังคงได้รับข้อผิดพลาด "babel: src ไม่มีอยู่"
นี่คือการบันทึกโค้ดของฉันโดยย่อ: https://drive.google.com/file/d/1YgEnJE87c0mEnsefY1xU94cvUedBtGhK/view
ดูด้านบนสิ่งที่ฉันได้ลอง
{
"name": "notes-app",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src -d lib"
},
"author": "Jono Suave",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2"
}
}
แอพ.js
import getNotes from "notes.js"
getNotes()
บันทึกย่อ js
let getNotes = function() {
console.log(`Put the time in baby!`)
}
module.exports = getNotes
ฉันคาดว่า Babel จะทำงานและรวบรวมรหัสนำเข้า ES6 ของฉันใน app.js แต่ได้รับข้อผิดพลาดต่อไปนี้ในเทอร์มินัลแทน:
babel:
src does not exist
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `babel src -d lib`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jonosuave/.npm/_logs/2019-11-07T01_56_26_260Z-debug.log
package.json
ภายใน ของsrc
หรือไม่? ปกติจะเป็นพี่น้องกัน - person loganfsmyth   schedule 07.11.2019