0

I am new to typescript and follow the tutorial to use lite-server, but when I use npm start I get the following error:

      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

My npm version is 4.6.1 and my node version is 6.2.0.

My package.json is simple and correct:

{
"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"
}
}

What is wrong?

Ryan
  • 19,118
  • 10
  • 37
  • 53
  • Spread in Object Literals is supported in Node >= 8.3 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax – madflow Jun 24 '21 at 07:29
  • @madflow So,you mean I could not use lite-server under my current environment unless I upgrade my node version to 8.3.0 or above? – Ryan Jun 24 '21 at 07:35
  • I can only assert - that the error comes from a spread operator in an object literal - which only works on NodeJS > 8.3.0... The latest LTS Version of Node.JS is `14`. Updating should make sense in any case. Sorry I have not used lite-server. – madflow Jun 24 '21 at 08:49

0 Answers0