---
slug: "install-fibers-failed-python-version"
title: "npm install fibers ( node-fibers ) をインストールしようとして ValueError: invalid mode: 'rU' while trying to load binding.gyp となる場合"
description: "`npm install fibers` (node-fibers) が `ValueError: invalid mode: 'rU'` で失敗する場合の対処。Python の `setup.py` が新しい Python で deprecate された flag を使っているので、Python 3.10 以下を使う。"
url: "https://www.ytyng.com/blog/install-fibers-failed-python-version"
publish_date: "2023-03-29T05:31:58Z"
created: "2023-03-29T05:31:58Z"
updated: "2026-05-11T13:15:59.705Z"
categories: ["Python"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250605/0c18847958104ddd82d20c20815d0f2f.png.webp?width=768"
has_video: true
has_music: true
video_urls: ["https://media.ytyng.net/ytyng-blog/277/featured-video-1.mp4", "https://media.ytyng.net/ytyng-blog/277/featured-video-2.mp4", "https://media.ytyng.net/ytyng-blog/277/featured-video-3.mp4"]
music_urls: ["https://media.ytyng.net/ytyng-blog/277/featured-music-277-1.mp3?v=2", "https://media.ytyng.net/ytyng-blog/277/featured-music-277-2.mp3?v=2"]
lang: "ja"
---

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

```shell
yarn install
```
したら

```
 ERROR  ## There is an issue with node-fibers ##
`..../node_modules/fibers/bin/darwin-x64-83/fibers.node` is missing.
```

が出て

```shell
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](https://github.com/nodejs/node-gyp/issues/2219)

Python のバージョンを変えるのも面倒だったので、コンパイルできないファイル `node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py` をエディタで開き、 

```python
build_file_contents = open(build_file_path, 'rU').read()
```

この行から `U` を除去して

```python
build_file_contents = open(build_file_path, 'r').read()
```

こうすると、 `npm install fibers` が成功する。
