Как исправить ошибку nodemon "объявления в области блока ..."? - PullRequest
0 голосов
/ 07 марта 2020

Это мой пакет. json файл:

{
  "name": "pro-mern-stack",
  "version": "1.0.0",
  "description": "first init",
  "main": "index.js",
  "scripts": {
    "start": "nodemon server.js server.js",
    "compile": "babel src --presets react,es2015 --out-dir static",
    "watch": "babel src --presets react,es2015 --out-dir static --watch",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Yusuf",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "express": "^4.17.1",
    "mongodb": "latest"
  },
  "devDependencies": {
    "express": "^4.17.1",
    "nodemon": "^2.0.2"
  }
}

Я ПЫТАЮСЬ ЗАПУСТИТЬ npm start ЗАПУСК ЧАСЫ, НО Я ПОЛУЧАЮ ЭТУ ОШИБКУ:

> nodemon server.js server.js

    C:\MERN\pro-mern-stack\node_modules\nodemon\lib\monitor\run.js:356
        let sig = signal.replace('SIG', '');
        ^^^

    SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
        at exports.runInThisContext (vm.js:53:16)
        at Module._compile (module.js:373:25)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Function.Module._load (module.js:300:12)
        at Module.require (module.js:353:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous> (C:\MERN\pro-mern-stack\node_modules\nodemon\lib\monitor\index.js:2:8)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)

    npm ERR! Windows_NT 10.0.10240
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
    npm ERR! node v4.5.0
    npm ERR! npm  v2.15.9
    npm ERR! code ELIFECYCLE
    npm ERR! pro-mern-stack@1.0.0 start: `nodemon server.js server.js`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the pro-mern-stack@1.0.0 start script 'nodemon server.js server.js'.
    npm ERR! This is most likely a problem with the pro-mern-stack package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     nodemon server.js server.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs pro-mern-stack
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!
    npm ERR!     npm owner ls pro-mern-stack
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\mern\pro-mern-stack\npm-debug.log 

Я работаю с powershell на windows 10. Я попытался установить глобально, не сработало. Также есть последняя версия nodemon. Пожалуйста, как я могу это исправить? Я переустанавливал nodemon несколько раз, постоянно получая ту же ошибку, даже когда запускаю ее прямо в консоли. Спасибо!

1 Ответ

0 голосов
/ 07 марта 2020

Я вижу проблему в скрипте npm. Вы должны просто обновить его до сервера nodemon. js

...