[英]npm start command I am getting syntaxerror: use of const in strict mode
xxx-nameKumar--MacBook-Pro:MyApp xxx-name$ npm start xxx-名称库马尔-MacBook-Pro:MyApp xxx-名称$ npm start
> @ start /Users/xxx-name/Desktop/FrontEnd/MyApp
> babel-node tools/run start
/Users/xxx-name/Desktop/FrontEnd/MyApp/tools/run.js:20
const task = typeof fn.default === 'undefined' ? fn : fn.default;
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at loader (/Users/xxx-name/Desktop/FrontEnd/MyApp/node_modules/babel-cli/node_modules/babel-register/lib/node.js:126:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/xxx-name/Desktop/FrontEnd/MyApp/node_modules/babel-cli/node_modules/babel-register/lib/node.js:136:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at /Users/xxx-name/Desktop/FrontEnd/MyApp/node_modules/babel-cli/lib/_babel-node.js:161:27
at Object.<anonymous> (/Users/xxx-name/Desktop/FrontEnd/MyApp/node_modules/babel-cli/lib/_babel-node.js:162:7)
at Module._compile (module.js:460:26)
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! @ start: `babel-node tools/run start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script 'babel-node tools/run start'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node tools/run start
npm ERR! You can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/xxx-name/Desktop/FrontEnd/MyApp/npm-debug.log
You have syntax error: 您有语法错误:
SyntaxError: Use of const in strict mode.
Do you have 'use strict' in your code? 您的代码中有“严格使用”吗?
What version of node do you have? 您有哪个版本的节点?
The const and let are part of ES6 and are not enabled by default in Node.js 0.10 or 0.12. const和let是ES6的一部分,默认情况下未在Node.js 0.10或0.12中启用。
Update nodejs. 更新nodejs。 Const is a new feature. const是一个新功能。 The version you have (0.12.0) is outdated. 您拥有的版本(0.12.0)已过时。 The link says you need 5.0 or newer. 该链接表明您需要5.0或更高版本。 Download and install 5.9.1 (not 4.4.1) form https://nodejs.org/en/ . 从https://nodejs.org/en/下载并安装5.9.1(不是4.4.1)。 Then try again. 然后再试一次。
You can try to update your npm by typing 您可以尝试通过键入以下内容来更新您的npm
sudo Npm install -g npm sudo Npm install -g npm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.