简体   繁体   English

npm start命令我遇到了语法错误:在严格模式下使用const

[英]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.

相关问题 语法错误:在严格模式下使用 const - SyntaxError: Use of const in strict mode const os = require(&#39;os&#39;)SyntaxError:在严格模式下使用const - const os = require('os') SyntaxError: Use of const in strict mode Visual Studio 任务运行程序“语法错误:在严格模式下使用 const。” - Visual Studio Task Runner "SyntaxError: Use of const in strict mode." 未捕获的SyntaxError:在严格模式下使用const Travis-ci业力测试与铬投掷 - Uncaught SyntaxError: Use of const in strict mode | Travis-ci karma test with chromium throws 严格模式下函数的SyntaxError - SyntaxError for functions in strict mode Typescript和Uncaught SyntaxError:在严格模式之外尚不支持块范围的声明(let,const,function,class) - Typescript and Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode SyntaxError:'with'语句在严格模式下无效 - SyntaxError: 'with' statements are not valid in strict mode 我在运行npm start时在ubuntu 16.04中遇到npm错误 - I am getting npm errors in ubuntu 16.04 when I run npm start 在npm上“使用严格” - 'use strict' on npm 未捕获的语法错误:意外的严格模式保留字 - Uncaught SyntaxError: Unexpected strict mode reserved word
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM