Javascript 如何解决npm启动时的这个节点js错误?
一旦我执行npm start,我就会出现以下错误 使用MacBookPro 错误片段 dbrax:bot-apple$npm启动Javascript 如何解决npm启动时的这个节点js错误?,javascript,node.js,npm,nodes,node-modules,Javascript,Node.js,Npm,Nodes,Node Modules,一旦我执行npm start,我就会出现以下错误 使用MacBookPro 错误片段 dbrax:bot-apple$npm启动 > bot@1.0.0 start /Users/apple/Desktop/saas/bot > nodemon index.js /Users/apple/Desktop/saas/bot/node_modules/chokidar/index.js:151 async remove(item) { ^^^^^^ SyntaxEr
> bot@1.0.0 start /Users/apple/Desktop/saas/bot
> nodemon index.js
/Users/apple/Desktop/saas/bot/node_modules/chokidar/index.js:151
async remove(item) {
^^^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/apple/Desktop/saas/bot/node_modules/nodemon/lib/monitor/watch.js:6:16)
at Module._compile (module.js:570:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bot@1.0.0 start: `nodemon index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bot@1.0.0 start 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/apple/.npm/_logs/2020-04-07T06_46_27_297Z-debug.log
上面的json包有一个脚本start,它执行nodemon index.js,但每次我执行npm start时,我都会得到上面的错误搜索,寻找如何解决它的线索,但没有关于堆栈流或其他源的结果。我想你忘记了
函数之前的关键字删除(项)
或使用箭头功能:
cons remove = async (item) => {
// Your function code here
}
您有哪个节点版本?
const async function remove(item) {
// Your function code here
}
cons remove = async (item) => {
// Your function code here
}