Help us understand the problem. What is going on with this article?

npx create-nuxt-app でpython2 command exists

自分の環境

mac mojave 10.14.6

$ node -v
v12.4.0

$ npm -v
6.9.0

$ pyenv versions
  system
  2.7.9
* 3.7.2

$ ndenv
ndenv 0.4.0

現象

久々にNuxt.jsでサイトを作ろうとして npx create-nuxt-app を実行したらエラー

エラーメッセージ

gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/ユーザー名/.pyenv/shims/python2 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/ユーザー名/.pyenv/shims/python2 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack pyenv: python2: command not found
gyp ERR! stack
gyp ERR! stack The `python2' command exists in these Python versions:
gyp ERR! stack   2.7.9
gyp ERR! stack
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:290:12)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
.
.
.
npm ERR! Failed at the fibers@4.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

なんだこれは、、、初めてみたエラーだ

fibers.node というモジュールがインストール失敗している?

原因

エラー内容を見ると、python2が必要らしい?

しかし、自分のデフォルトpythonは3.7.2のpython3を設定している。

このプロジェクト内でpython2を指定したらいいだけ?

解決方法

この方法で無事にインストールできた。

まずプロジェクト内に移動し、pyenv localでpython2を指定する。

$ cd nuxtjs-project
$ pyenv local 2.7.9

$ pyenv versions
  system
* 2.7.9
  3.7.2

そして再度インストールを実行

$ npm install

ズラズラとログが流れ

Installed in `/Users/ユーザー名/dev/nuxtjs-projet/node_modules/fibers/bin/darwin-x64-72/fibers.node`

お、fibers.nodeがインストール&ビルド成功したらしい

この後、$ npm run devで無事にサイトがローカル表示できた。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした