Получение ошибки при запуске npm в проекте

#angular #ionic-framework #npm

#angular #ionic-framework #npm

Вопрос:

Я пытаюсь запустить проект после установки модулей npm.

Когда я печатаю npm start , я получаю:

 There is an error in your gulpfile: 
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> (/Users/tkhusid/WebstormProjects/Ionic-`enter code here`radar/ionic-radar/config/gulp/index.js:1:63)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
  

Кроме того, я получаю другие ошибки рядом с этой ошибкой:

 npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev:stub"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! techradar-ionic@0.2.0 dev:stub: `ionic serve --environment local`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the techradar-ionic@0.2.0 dev:stub script 'ionic serve --environment local'.
npm ERR! This is most likely a problem with the techradar-ionic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic serve --environment local
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs techradar-ionic
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls techradar-ionic
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/tkhusid/WebstormProjects/Ionic-radar/ionic-radar/npm-debug.log

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! techradar-ionic@0.2.0 dev: `npm run dev:stub`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the techradar-ionic@0.2.0 dev script 'npm run dev:stub'.
npm ERR! This is most likely a problem with the techradar-ionic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run dev:stub
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs techradar-ionic
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls techradar-ionic
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/tkhusid/WebstormProjects/Ionic-radar/ionic-radar/npm-debug.log

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! techradar-ionic@0.2.0 start: `npm run dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the techradar-ionic@0.2.0 start script 'npm run dev'.
npm ERR! This is most likely a problem with the techradar-ionic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run dev
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs techradar-ionic
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls techradar-ionic
npm ERR! There is likely additional logging output above.
  

Я начал с клонирования проекта.
Проект был успешно клонирован.

Большое спасибо за любую помощь.

Комментарии:

1. попробуйте использовать nodejs v6 вместо v4; node v6 имеет лучшую поддержку ecmascript 6, и ошибка, похоже, связана с этим (код написан на es6)

2. Спасибо. Попробую сейчас

3. Не помогает 🙁

4. О, ты был прав, приятель! Это работает! Я загрузил node6. Затем я обновил некоторые библиотеки npm, и это заработало. Большое спасибо!

5. Хорошо, я опубликовал ответ, чтобы вы могли пометить вопрос как решенный 🙂

Ответ №1:

Просмотр сообщения об ошибке

Объявления с блочной областью (let, const, function, class) еще не поддерживаются вне строгого режима

похоже, проблема связана с тем фактом, что код написан с использованием ECMAScript 6, и вы используете nodejs v4, который еще не полностью поддерживает ES6. Попробуйте перейти на nodejs v6, который имеет лучшую поддержку ES6, и, возможно, обновите некоторые зависимости npm.

ОШИБКА npm! узел v4.6.0