Trying to Install npm install fibers (node-fibers) Results in ValueError: invalid mode: 'rU' While Trying to Load binding.gyp

Python
2023-03-29 14:31 (1 years ago) ytyng

After running

yarn install

I encountered the following error:

 ERROR  ## There is an issue with node-fibers ##
`..../node_modules/fibers/bin/darwin-x64-83/fibers.node` is missing.

To resolve this, I proceeded with

npm install fibers

However, this resulted in another error:

  File "/<home>/.asdf/installs/nodejs/14.7.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2782, in Load
    LoadTargetBuildFile(build_file, data, aux_data,
  File "/<home>/.asdf/installs/nodejs/14.7.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
    build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<home>/.asdf/installs/nodejs/14.7.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 234, in LoadOneBuildFile
    build_file_contents = open(build_file_path, 'rU').read()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU' while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1

According to a GitHub issue, this error is related to the Python version.

ValueError: invalid mode: 'rU' while trying to load binding.gyp (Python 3.9 compatibility issue) · Issue #2219 · nodejs/node-gyp

Changing the Python version seemed cumbersome, so I opened the problematic file node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py in an editor and removed the U from the following line:

build_file_contents = open(build_file_path, 'rU').read()

Changing it to:

build_file_contents = open(build_file_path, 'r').read()

After making this change, npm install fibers executed successfully.

Current rating: 4.7
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Comments

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011