启动reactjs应用程序时找不到gifsicle二进制文件

问题描述

我们在 package.json 中使用 gifsicle 5.1.0 版本,但是应用程序启动时抛出以下错误。它期望在 node_modules/gifsicle/vendor 文件夹下有一个二进制 gifsicle,但尝试使用“yarn dev”启动应用程序不起作用。任何指针都会有帮助

webpack:///./node_modules/slick-carousel/slick/ajax-loader.gif?:1
throw new Error("Module build Failed (from ./node_modules/image-webpack-loader/index.js):\nError: spawn /home/user/webapp/node_modules/gifsicle/vendor/gif
sicle ENOENT\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)\n    at onErrorNT (internal/child_process.js:465:16)\n    at processticksAndRejections (inte
rnal/process/task_queues.js:80:21)");

错误好像如下

Output:
⚠ Response code 404 (Not Found)
  ⚠ gifsicle pre-build test Failed
  ℹ compiling from source
  ✖ Error: Command Failed: /bin/sh -c ./configure --disable-gifview --disable-gifdiff --prefix="/home/user/webapp/node_modules/gifsicle/vendor" --bindir="
/home/user/webapp/node_modules/gifsicle/vendor"
    config.status: error: in `/tmp/7314af85-eb99-48d5-963f-47a8d2e141a1':
    config.status: error: Something went wrong bootstrapping makefile fragments
        for automatic dependency tracking.  Try re-running configure with the
        '--disable-dependency-tracking' option to at least be able to build
        the package (albeit without support for automatic dependency tracking).
    See `config.log' for more details

config.log contains the following

gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
configure:3384: $? = 0
configure:3373: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: Fatal error: no input files
compilation terminated.
configure:3384: $? = 1
configure:3373: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: Fatal error: no input files
compilation terminated.
configure:3384: $? = 1
configure:3404: checking whether the C compiler works
configure:3426: gcc    conftest.c  >&5
configure:3430: $? = 0
configure:3478: result: yes
configure:3481: checking for C compiler default output file name
configure:3483: result: a.out

        Environment:
        nvm use 14.15.1
        Ubuntu 20.04 LTS

解决方法

迁移到 4.0.1 解决了问题

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...