Ошибка при запуске lite-сервера - PullRequest
0 голосов
/ 01 мая 2018

я сделал новый "npm init". поставить точку входа: "index.html"

затем установил lite-сервер: npm установить облегченный сервер --save-dev

также обновил package.json

    {
  "name": "newjs",
  "version": "1.0.0",
  "description": "nothing",
  "main": "index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start" : "npm run lite",
    "lite" : "lite-server"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "lite-server": "^2.3.0"
  }
}

Но когда я сделал "npm start", получаю эту ошибку

D:\mudit\newjs>npm start

newjs@1.0.0 start D: \ mudit \ newjs npm run lite

> newjs@1.0.0 lite D:\mudit\newjs
> lite-server

Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
** browser-sync config **
{ injectChanges: false,
  files: [ './**/*.{html,htm,css,js}' ],
  watchOptions: { ignored: 'node_modules' },
  server: { baseDir: './', middleware: [ [Function], [Function] ] } }
D:\mudit\newjs\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_modules\engine.io\node_modules\ws\index.js:9
const WebSocket = require('./lib/WebSocket');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Server.init (D:\mudit\newjs\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_modules\engine.io\lib\server.js:115:16)
    at new Server (D:\mudit\newjs\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_modules\engine.io\lib\server.js:65:8)
    at Function.attach (D:\mudit\newjs\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_modules\engine.io\lib\engine.io.js:123:16)

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lite"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! newjs@1.0.0 lite: `lite-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the newjs@1.0.0 lite script 'lite-server'.
npm ERR! This is most likely a problem with the newjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     lite-server
npm ERR! You can get their info via:
npm ERR!     npm owner ls newjs
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\mudit\newjs\npm-debug.log

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! newjs@1.0.0 start: `npm run lite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the newjs@1.0.0 start script 'npm run lite'.
npm ERR! This is most likely a problem with the newjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run lite
npm ERR! You can get their info via:
npm ERR!     npm owner ls newjs
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\mudit\newjs\npm-debug.log

Пожалуйста, помогите, поскольку я даже не могу запустить lite-сервер. заранее спасибо.

...