Приложение React не может быть скомпилировано из-за синтаксиса «ошибки», который не похож на ошибки - PullRequest
0 голосов
/ 17 мая 2019

Я клонировал git-репозиторий приложения React на сервере CentOS и пытаюсь его запустить. Я получаю кучу ошибок, которые ... не имеют смысла.

Я запускаю npm install, а затем npm run build.

Вывод начинается с этого:

my-app@ build /local/scratch/my-app/app webpack --mode development --progress

затем какой-то прогресс процесса сборки, а затем сообщения об ошибках:

ERROR in ./node_modules/@babel/runtime/helpers/classCallCheck.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /local/scratch/my-app/my-app/app/node_modules/@babel/runtime/helpers/classCallCheck.js: Unexpected keyword 'throw' (3:4)

  1 | function _classCallCheck(instance, Constructor) {
  2 |   if (!(instance instanceof Constructor)) {
> 3 |     throw new TypeError("Cannot call a class as a function");
    |     ^
  4 |   }
  5 | }
  6 | 

В основном, большинство из них не выглядят так, как будто они должны быть синтаксическими ошибками. Я получаю около миллиарда ошибок, каждая из которых сопровождается трассировкой стека. Наконец, это в самом конце:

npm ERR! Linux 3.10.0-693.2.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v6.16.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-app@ build: `webpack --mode development --progress`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@ build script 'webpack --mode development --progress'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the m-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --mode development --progress
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs my-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls my-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /local/scratch/my-app/my-app/app/npm-debug.log


Что мне делать дальше? Любая помощь приветствуется, и я могу опубликовать больше информации, если это необходимо. Спасибо!

...