npm install fibers ( node-fibers ) をインストールしようとして ValueError: invalid mode: 'rU' while trying to load binding.gyp となる場合

投稿者: ytyng 1年, 1ヶ月 前
yarn install

したら

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

が出て

npm install fibers

したら

  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

が出た。

Github の Issue を見ると、Python のバージョンによるものらしい。

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

Python のバージョンを変えるのも面倒だったので、コンパイルできないファイル node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py をエディタで開き、

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

この行から U を除去して

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

こうすると、 npm install fibers が成功する。

現在の評価: 5

コメント

アーカイブ

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