Error in building due to node-gyp

Hello,
I have a static website in Gatsby up for few years now, has always been working but starting from approximately 2 days ago has started to fail building (same commit was correctly deployed on Aug 29 2024, and instead it failed Sept 05 2024)

The error happens in the building process here:
sharp@0.30.7 install /opt/render/project/src/node_modules/sharp

Sep 5 10:33:26 AM> (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Sep 5 10:33:26 AM
Sep 5 10:33:26 AMsharp: Detected globally-installed libvips v8.14.1
Sep 5 10:33:26 AMsharp: Building from source via node-gyp

the error is the following: ValueError: invalid mode: 'rU' while trying to load binding.gyp

I have tried to change PYTHON_VERSION to 3.10.13 but did not help, any idea on how to fix it?
Thank you very much,
Mario

below the full stack trace:

Traceback (most recent call last):

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>

Sep 6 10:58:52 AM sys.exit(gyp.script_main())

Sep 6 10:58:52 AM ^^^^^^^^^^^^^^^^^

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main

Sep 6 10:58:52 AM return main(sys.argv[1:])

Sep 6 10:58:52 AM ^^^^^^^^^^^^^^^^^^

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main

Sep 6 10:58:52 AM return gyp_main(args)

Sep 6 10:58:52 AM ^^^^^^^^^^^^^^

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 520, in gyp_main

Sep 6 10:58:52 AM [generator, flat_list, targets, data] = Load(

Sep 6 10:58:52 AM ^^^^^

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 136, in Load

Sep 6 10:58:52 AM result = gyp.input.Load(build_files, default_variables, includes[:],

Sep 6 10:58:52 AM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2782, in Load

Sep 6 10:58:52 AM LoadTargetBuildFile(build_file, data, aux_data,

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile

Sep 6 10:58:52 AM build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,

Sep 6 10:58:52 AM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sep 6 10:58:52 AM File "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 234, in LoadOneBuildFile

Sep 6 10:58:52 AM build_file_contents = open(build_file_path, 'rU').read()

Sep 6 10:58:52 AM ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sep 6 10:58:52 AMValueError: invalid mode: 'rU' while trying to load binding.gyp

Sep 6 10:58:52 AMgyp ERR! configure error

Sep 6 10:58:52 AMgyp ERR! stack Error: `gyp` failed with exit code: 1

Sep 6 10:58:52 AMgyp ERR! stack at ChildProcess.onCpExit (/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)

Sep 6 10:58:52 AMgyp ERR! stack at ChildProcess.emit (events.js:376:20)

Sep 6 10:58:52 AMgyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)

Sep 6 10:58:52 AMgyp ERR! System Linux 6.5.0-1021-aws

Sep 6 10:58:52 AMgyp ERR! command "/opt/render/project/nodes/node-14.17.0/bin/node" "/opt/render/project/nodes/node-14.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

Sep 6 10:58:52 AMgyp ERR! cwd /opt/render/project/src/node_modules/sharp

Sep 6 10:58:52 AMgyp ERR! node -v v14.17.0

Sep 6 10:58:52 AMgyp ERR! node-gyp -v v5.1.0

Sep 6 10:58:52 AMgyp ERR! not ok

Sep 6 10:58:53 AMnpm ERR! code ELIFECYCLE

Sep 6 10:58:53 AMnpm ERR! errno 1

Sep 6 10:58:53 AMnpm ERR! sharp@0.30.7 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)`

Sep 6 10:58:53 AMnpm ERR! Exit status 1

Sep 6 10:58:53 AMnpm ERR!

Sep 6 10:58:53 AMnpm ERR! Failed at the sharp@0.30.7 install script.

Sep 6 10:58:53 AMnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Sep 6 10:58:53 AM

Sep 6 10:58:53 AMnpm ERR! A complete log of this run can be found in:

Sep 6 10:58:53 AMnpm ERR! /opt/render/.cache/_logs/2024-09-06T08_58_53_598Z-debug.log

I think i solved it independently by adjusting node version to a more recent one (18.18.1)
thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.