首页 > 解决方案 > Lite-server 无法启动,原因是“Unexpected token ...”

问题描述

我是 typescript 的新手并按照教程使用 lite-server,但是当我使用时npm start出现以下错误:

      D:\web_demo\tsTest\node_modules\micromatch\index.js:44
  let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
                                                ^^^
SyntaxError: Unexpected token ...
  at Object.exports.runInThisContext (vm.js:53:16)
  at Object.Module._extensions..js (module.js:550:10)
  at tryModuleLoad (module.js:417:12)
  at Function.Module._load (module.js:409:3)
  at Module.require (module.js:468:17)
  at require (internal/module.js:20:19)
  at Object.<anonymous> (D:\web_demo\tsTest\node_modules\browser-sync\dist\public\stream.js:3:18)
  at Module._compile (module.js:541:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aa@1.0.0 start: `lite-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aa@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!     C:\Users\zouxing\AppData\Roaming\npm-cache\_logs\2021-06-24T07_11_23_793Z-debug.log

我的npm版本是4.6.1,我的node版本是6.2.0

我的 package.json 简单而正确:

{
"name": "aa",
"version": "1.0.0",
"description": "",
"main": "test.js",
"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "start":"lite-server"
},
"author": "",
"license": "ISC",
"dependencies": {

},
"devDependencies": {
  "lite-server": "^2.6.1"
}
}

怎么了?

标签: javascriptnode.jsnpmlite-server

解决方案


推荐阅读