由于语法'错误'看起来不像错误,因此React App无法构建

时间:2019-05-17 18:16:07

标签: reactjs npm webpack centos package.json

我已经在CentOS服务器上克隆了一个React应用程序的git仓库,我正在尝试运行它。我收到了很多错误,这些错误...没有道理。

我先运行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


接下来我应该尝试什么?感谢您的帮助,如有需要,我可以发布更多信息。谢谢!

0 个答案:

没有答案