老师报错信息,解决不了
报错信息
C:\Users\爱喝茶的小六子\Desktop\Visual Studio Code\html学习课程>npm run build
> babel@1.0.0 build C:\Users\爱喝茶的小六子\Desktop\Visual Studio Code\html学习课程
> babel src -d dist
C:\Users\爱喝茶的小六子\Desktop\Visual Studio Code\html学习课程\node_modules\@babel\cli\node_modules\commander\index.js:95
class CommanderError extends Error {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\爱喝茶的小六子\Desktop\Visual Studio Code\html学习课程\node_modules\@babel\cli\lib\babel\options.js:20:19)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
npm ERR! Windows_NT 10.0.19042
npm ERR! argv "D:\\Node.js\\node.exe" "D:\\Node.js\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! babel@1.0.0 build: `babel src -d dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the babel@1.0.0 build script 'babel src -d dist'.
npm ERR! This is most likely a problem with the babel package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel src -d dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs babel
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls babel
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\爱喝茶的小六子\Desktop\Visual Studio Code\html学习课程\npm-debug.log
C:\Users\爱喝茶的小六子\Desktop\Visual Studio Code\html学习课程>
babel.js代码
let name = 'Alex';
const age = 18;
const add = (x,y) => x + y;
new Promise((resolve,reject) => {
resolve('success');
})
Array.from([1,2]);
class Person{}
// import './index.js';
老师,dist目录是自己手动创建还是执行完npm run build时自动创建的
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星