Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 意外标记:生产生成中的运算符(>;)_Reactjs - Fatal编程技术网

Reactjs 意外标记:生产生成中的运算符(>;)

Reactjs 意外标记:生产生成中的运算符(>;),reactjs,Reactjs,我是个新手,目前正在对现有应用程序进行一个小的更改 我做了更改并在本地进行了测试。一切都很好。npm启动和npm运行构建都可以正常工作,没有任何错误。 此应用程序在Azure DevOps中具有CI设置,当我签入代码时,CI构建失败。日志在下面 npm ERR! Windows_NT 6.3.9600 > react-scripts build npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files

我是个新手,目前正在对现有应用程序进行一个小的更改

我做了更改并在本地进行了测试。一切都很好。npm启动和npm运行构建都可以正常工作,没有任何错误。 此应用程序在Azure DevOps中具有CI设置,当我签入代码时,CI构建失败。日志在下面

 npm ERR! Windows_NT 6.3.9600
 > react-scripts build
 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"

 npm ERR! node v6.9.1
 Creating an optimized production build...
 npm ERR! npm  v3.10.8
 Skipping static resource "D:/a/1/s/MyAppClient/build/static/js/main.b7fe64b2.js" (5.36 MB) - max size is 2.1 MB
 npm ERR! code ELIFECYCLE
 Failed to compile.
 npm ERR! MyAppclient@0.1.0 build: `react-scripts build`

 npm ERR! Exit status 1
 static/js/main.b7fe64b2.js from UglifyJs
 npm ERR! 
 Unexpected token: operator (>) [./~/file-type/index.js:2,0][static/js/main.b7fe64b2.js:51965,19]
 npm ERR! Failed at the MyAppclient@0.1.0 build script 'react-scripts build'.

 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 MyAppclient package,
 npm ERR! not with npm itself.
 npm ERR! Tell the author that this fails on your system:
 npm ERR!     react-scripts build
 npm ERR! You can get information on how to open an issue for this project with:
 npm ERR!     npm bugs MyAppclient
 npm ERR! Or if that isn't available, you can get their info via:
 npm ERR!     npm owner ls MyAppclient
 npm ERR! There is likely additional logging output above.

 npm ERR! Please include the following file with any support request:
 npm ERR!     D:\a\1\s\MyAppClient\npm-debug.log
 Found npm debug log, make sure the path matches with the one in npm's output: D:\a\1\s\MyAppClient\npm-debug.log
 0 info it worked if it ends with ok
 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
 1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
 1 verbose cli   'run',
 1 verbose cli   'build' ]
 2 info using npm@3.10.8
 3 info using node@v6.9.1
 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
 5 info lifecycle MyAppclient@0.1.0~prebuild: MyAppclient@0.1.0
 6 silly lifecycle MyAppclient@0.1.0~prebuild: no script for prebuild, continuing
 7 info lifecycle MyAppclient@0.1.0~build: MyAppclient@0.1.0
 8 verbose lifecycle MyAppclient@0.1.0~build: unsafe-perm in lifecycle true
 9 verbose lifecycle MyAppclient@0.1.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\a\1\s\MyAppClient\node_modules\.bin;C:\agents\2.142.1\externals\git\cmd;C:\ProgramData\Oracle\Java\javapath;C:\W
 10 verbose lifecycle MyAppclient@0.1.0~build: CWD: D:\a\1\s\MyAppClient
 11 silly lifecycle MyAppclient@0.1.0~build: Args: [ '/d /s /c', 'react-scripts build' ]
 12 silly lifecycle MyAppclient@0.1.0~build: Returned: code: 1  signal: null
 13 info lifecycle MyAppclient@0.1.0~build: Failed to exec build script
 14 verbose stack Error: MyAppclient@0.1.0 build: `react-scripts build`
 14 verbose stack Exit status 1
 14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
 14 verbose stack     at emitTwo (events.js:106:13)
 14 verbose stack     at EventEmitter.emit (events.js:191:7)
 14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
 14 verbose stack     at emitTwo (events.js:106:13)
 14 verbose stack     at ChildProcess.emit (events.js:191:7)
 14 verbose stack     at maybeClose (internal/child_process.js:877:16)
 14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
 15 verbose pkgid MyAppclient@0.1.0
 16 verbose cwd D:\a\1\s\MyAppClient
 17 error Windows_NT 6.3.9600
 18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
 19 error node v6.9.1
 20 error npm  v3.10.8
 21 error code ELIFECYCLE
 22 error MyAppclient@0.1.0 build: `react-scripts build`
 22 error Exit status 1
 23 error Failed at the MyAppclient@0.1.0 build script 'react-scripts build'.
 23 error Make sure you have the latest version of node.js and npm installed.
 23 error If you do, this is most likely a problem with the MyAppclient package,
 23 error not with npm itself.
 23 error Tell the author that this fails on your system:
 23 error     react-scripts build
 23 error You can get information on how to open an issue for this project with:
 23 error     npm bugs MyAppclient
 23 error Or if that isn't available, you can get their info via:
 23 error     npm owner ls MyAppclient
 23 error There is likely additional logging output above.
 24 verbose exit [ 1, true ]

 ##[error]Error: Npm failed with return code: 1
 ##[section]Finishing: Build Client
npm错误!Windows NT 6.3.9600
>反应脚本生成
npm错误!argv“C:\\Program Files\\nodejs\\node.exe”“C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js”“运行”“生成”
npm错误!节点v6.9.1
正在创建优化的生产构建。。。
npm错误!npm v3.10.8
跳过静态资源“D:/a/1/s/MyAppClient/build/static/js/main.b7fe64b2.js”(5.36 MB)-最大大小为2.1 MB
npm错误!代码失效循环
未能编译。
npm错误!MyAppclient@0.1.0build:`react脚本build`
npm错误!退出状态1
来自UglifyJs的static/js/main.b7fe64b2.js
npm错误!
意外标记:operator(>)[./~/file-type/index.js:2,0][static/js/main.b7fe64b2.js:51965,19]
npm错误!失败MyAppclient@0.1.0生成脚本“反应脚本生成”。
npm错误!确保已安装最新版本的node.js和npm。
npm错误!如果是这样,这很可能是MyAppclient包的问题,
npm错误!与npm本身无关。
npm错误!告诉作者此操作在您的系统上失败:
npm错误!反应脚本生成
npm错误!您可以通过以下方式获取有关如何打开此项目问题的信息:
npm错误!npm bugs MyAppclient
npm错误!或者,如果不可用,您可以通过以下方式获取他们的信息:
npm错误!npm所有者ls MyAppclient
npm错误!上面可能还有其他日志输出。
npm错误!请在任何支持请求中包括以下文件:
npm错误!D:\a\1\s\MyAppClient\npm-debug.log
找到npm调试日志,请确保路径与npm输出中的路径匹配:D:\a\1\s\MyAppClient\npm-debug.log
0信息如果以“确定”结尾,则有效
1详细cli['C:\\Program Files\\nodejs\\node.exe',
1 verbose cli'C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js',
1详细cli“运行”,
1详细cli“生成”]
2信息使用npm@3.10.8
3信息使用node@v6.9.1
4详细运行脚本['prebuild'、'build'、'postbuild']
5信息生命周期MyAppclient@0.1.0~prebuild:MyAppclient@0.1.0
6愚蠢的生命周期MyAppclient@0.1.0~prebuild:没有用于预构建的脚本,正在继续
7信息生命周期MyAppclient@0.1.0~build:MyAppclient@0.1.0
8详细的生命周期MyAppclient@0.1.0~build:生命周期中的不安全烫发为true
9详细的生命周期MyAppclient@0.1.0~build:PATH:C:\Program Files\nodejs\node\u modules\npm\bin\node-gyp-bin;D:\a\1\s\MyAppClient\node\u modules\.bin;C:\agents\2.142.1\externals\git\cmd;C:\ProgramData\Oracle\Java\javapath;C:\W
10详细的生命周期MyAppclient@0.1.0~build:CWD:D:\a\1\s\MyAppClient
11愚蠢的生命周期MyAppclient@0.1.0~build:Args:['/d/s/c','react scripts build']
12愚蠢的生命周期MyAppclient@0.1.0~build:返回:代码:1信号:null
13信息生命周期MyAppclient@0.1.0~build:无法执行生成脚本
14详细堆栈错误:MyAppclient@0.1.0build:`react脚本build`
14详细堆栈退出状态1
14 EventEmitter上的详细堆栈。(C:\Program Files\nodejs\node\u modules\npm\lib\utils\lifecycle.js:255:16)
14 emitTwo上的详细堆栈(events.js:106:13)
14 EventEmitter.emit上的详细堆栈(events.js:191:7)
14子进程上的详细堆栈。(C:\Program Files\nodejs\node\u modules\npm\lib\utils\spawn.js:40:14)
14 emitTwo上的详细堆栈(events.js:106:13)
14 ChildProcess.emit上的详细堆栈(events.js:191:7)
14 maybeClose的详细堆栈(internal/child_process.js:877:16)
14 Process.ChildProcess.\u handle.onexit处的详细堆栈(internal/child\u Process.js:226:5)
15详细的pkgidMyAppclient@0.1.0
16详细cwd:\a\1\s\MyAppClient
17错误窗口\u NT 6.3.9600
18错误argv“C:\\Program Files\\nodejs\\node.exe”“C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js”“运行”“生成”
19错误节点v6.9.1
20错误npm v3.10.8
21错误代码ELIFECYCLE
22错误MyAppclient@0.1.0build:`react脚本build`
22错误退出状态1
23发生错误时失败MyAppclient@0.1.0生成脚本“反应脚本生成”。
23错误确保已安装最新版本的node.js和npm。
23错误如果您这样做,这很可能是MyAppclient包的问题,
23与npm本身无关的错误。
23错误告诉作者此操作在您的系统上失败:
23生成错误脚本
23错误您可以通过以下方式获取有关如何打开此项目问题的信息:
23错误npm错误MyAppclient
23错误或如果不可用,您可以通过以下方式获取他们的信息:
23错误npm所有者ls MyAppclient
23错误上面可能有额外的日志输出。
24详细退出[1,true]
##[错误]错误:Npm失败,返回代码:1
##[部分]完成:构建客户端
我不知道问题是什么,但我感觉一定是“意外令牌:运算符(>)”


您能告诉我我缺少什么吗?

意外令牌:操作员(>)

通常发生在生成的捆绑包中有一个箭头函数(
=>
)并且它在不支持箭头函数的js环境中执行时(ES6以下)

对此没有直接的解决办法。但是你可以尝试两件事

  • 向执行环境添加箭头功能支持(可能升级)
  • 找出代码库中生成箭头函数的代码/包。例如,我曾经遇到过这个问题,花了我一天的时间才弄明白。我使用了一个名为
    querystring
    的包,它的源代码不是babel传输的,代码中有箭头函数。我必须在webpack中添加一个配置来传输该包(除非您明确指定,否则webpack不会传输
    node\u modules
    中的代码)

  • 您是否有
    react
    作为其中一个