回答編集履歴

2 内容追記

kazto

kazto score 6345

2019/03/04 12:34  投稿

外していたらすみません。
ひょっとして、rootで実行したら解決する、と言う話ではないでしょうか。
```Bash
誤)
$ npm install -g expo-cli
正)
$ sudo npm install -g expo-cli
```
---
追記:
手元で試してみました。
```Plain
$ npm i expo-cli
> node-pty-prebuilt@0.7.6 install /Users/kazto/Documents/node_modules/node-pty-prebuilt
> prebuild-install || node scripts/install.js
prebuild-install WARN install No prebuilt binaries found (target=11.6.0 runtime=node arch=x64 libc= platform=darwin)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/kazto/.pyenv/shims/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack  File "<string>", line 1
gyp ERR! stack    import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                               ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack    at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack    at ChildProcess.emit (events.js:188:13)
gyp ERR! stack    at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack    at Socket.stream.socket.on (internal/child_process.js:395:11)
gyp ERR! stack    at Socket.emit (events.js:188:13)
gyp ERR! stack    at Pipe._handle.close (net.js:610:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--build_v8_with_gn=false"
gyp ERR! cwd /Users/kazto/Documents/node_modules/node-pty-prebuilt
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open '/Users/kazto/Documents/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/kazto/Documents/package.json'
npm WARN gatsby-source-filesystem@2.0.3 requires a peer of gatsby@>2.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-transformer-yaml@2.1.3 requires a peer of gatsby@>2.0.15 but none is installed. You must install peer dependencies yourself.
npm WARN Documents No description
npm WARN Documents No repository field.
npm WARN Documents No README data
npm WARN Documents No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-darwin-ia32@2.2.8 (node_modules/@expo/ngrok-bin-darwin-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-darwin-ia32@2.2.8: wanted {"os":"darwin","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-ia32@2.2.8 (node_modules/@expo/ngrok-bin-freebsd-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-ia32@2.2.8: wanted {"os":"freebsd","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-arm64@2.2.8 (node_modules/@expo/ngrok-bin-linux-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-arm64@2.2.8: wanted {"os":"linux","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-ia32@2.2.8 (node_modules/@expo/ngrok-bin-linux-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-ia32@2.2.8: wanted {"os":"linux","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-arm@2.2.8 (node_modules/@expo/ngrok-bin-linux-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-arm@2.2.8: wanted {"os":"linux","arch":"arm"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-x64@2.2.8 (node_modules/@expo/ngrok-bin-freebsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-x64@2.2.8: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-sunos-x64@2.2.8 (node_modules/@expo/ngrok-bin-sunos-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-sunos-x64@2.2.8: wanted {"os":"sunos","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-win32-x64@2.2.8-beta.1 (node_modules/@expo/ngrok-bin-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-win32-x64@2.2.8-beta.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-win32-ia32@2.2.8-beta.1 (node_modules/@expo/ngrok-bin-win32-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: wanted {"os":"win32","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-x64@2.2.8 (node_modules/@expo/ngrok-bin-linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-x64@2.2.8: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-linux@1.8.0 (node_modules/@expo/traveling-fastlane-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/traveling-fastlane-linux@1.8.0: wanted {"os":"win32,linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty-prebuilt@0.7.6 (node_modules/node-pty-prebuilt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty-prebuilt@0.7.6 install: `prebuild-install || node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ expo-cli@2.11.6
updated 1 package and audited 14838 packages in 17.071s
found 10 vulnerabilities (5 low, 5 moderate)
 run `npm audit fix` to fix them, or `npm audit` for details
```
私の環境では、これだけの量のログが出ています。
質問者様には、再度お願いいたしますが、ログを全文貼り付けるよう、お願いします。
~~私の環境では、これだけの量のログが出ています。
質問者様には、再度お願いいたしますが、ログを全文貼り付けるよう、お願いします。~~
---
「npm ERR! code MODULE_NOT_FOUND」で検索したところ、下記に当たりました。
[https://github.com/tj/n/issues/453](https://github.com/tj/n/issues/453)
一度、node_modulesフォルダを全削除してNode.jsをインストールしなおすと上手くいく、とのことです。
```Bash
$ sudo rm -rf /usr/local/lib/node_modules
$ curl -0 -L https://npmjs.com/install.sh | sudo sh
```
1 内容追記

kazto

kazto score 6345

2019/03/04 12:19  投稿

外していたらすみません。
ひょっとして、rootで実行したら解決する、と言う話ではないでしょうか。
```Bash
誤)
$ npm install -g expo-cli
正)
$ sudo npm install -g expo-cli
```
```
---
追記:
手元で試してみました。
```Plain
$ npm i expo-cli
> node-pty-prebuilt@0.7.6 install /Users/kazto/Documents/node_modules/node-pty-prebuilt
> prebuild-install || node scripts/install.js
prebuild-install WARN install No prebuilt binaries found (target=11.6.0 runtime=node arch=x64 libc= platform=darwin)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/kazto/.pyenv/shims/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack  File "<string>", line 1
gyp ERR! stack    import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                               ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack    at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack    at ChildProcess.emit (events.js:188:13)
gyp ERR! stack    at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack    at Socket.stream.socket.on (internal/child_process.js:395:11)
gyp ERR! stack    at Socket.emit (events.js:188:13)
gyp ERR! stack    at Pipe._handle.close (net.js:610:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--build_v8_with_gn=false"
gyp ERR! cwd /Users/kazto/Documents/node_modules/node-pty-prebuilt
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open '/Users/kazto/Documents/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/kazto/Documents/package.json'
npm WARN gatsby-source-filesystem@2.0.3 requires a peer of gatsby@>2.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-transformer-yaml@2.1.3 requires a peer of gatsby@>2.0.15 but none is installed. You must install peer dependencies yourself.
npm WARN Documents No description
npm WARN Documents No repository field.
npm WARN Documents No README data
npm WARN Documents No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-darwin-ia32@2.2.8 (node_modules/@expo/ngrok-bin-darwin-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-darwin-ia32@2.2.8: wanted {"os":"darwin","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-ia32@2.2.8 (node_modules/@expo/ngrok-bin-freebsd-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-ia32@2.2.8: wanted {"os":"freebsd","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-arm64@2.2.8 (node_modules/@expo/ngrok-bin-linux-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-arm64@2.2.8: wanted {"os":"linux","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-ia32@2.2.8 (node_modules/@expo/ngrok-bin-linux-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-ia32@2.2.8: wanted {"os":"linux","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-arm@2.2.8 (node_modules/@expo/ngrok-bin-linux-arm):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-arm@2.2.8: wanted {"os":"linux","arch":"arm"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-x64@2.2.8 (node_modules/@expo/ngrok-bin-freebsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-x64@2.2.8: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-sunos-x64@2.2.8 (node_modules/@expo/ngrok-bin-sunos-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-sunos-x64@2.2.8: wanted {"os":"sunos","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-win32-x64@2.2.8-beta.1 (node_modules/@expo/ngrok-bin-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-win32-x64@2.2.8-beta.1: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-win32-ia32@2.2.8-beta.1 (node_modules/@expo/ngrok-bin-win32-ia32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-win32-ia32@2.2.8-beta.1: wanted {"os":"win32","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-linux-x64@2.2.8 (node_modules/@expo/ngrok-bin-linux-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-linux-x64@2.2.8: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-linux@1.8.0 (node_modules/@expo/traveling-fastlane-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/traveling-fastlane-linux@1.8.0: wanted {"os":"win32,linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty-prebuilt@0.7.6 (node_modules/node-pty-prebuilt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty-prebuilt@0.7.6 install: `prebuild-install || node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ expo-cli@2.11.6
updated 1 package and audited 14838 packages in 17.071s
found 10 vulnerabilities (5 low, 5 moderate)
 run `npm audit fix` to fix them, or `npm audit` for details
```
私の環境では、これだけの量のログが出ています。
質問者様には、再度お願いいたしますが、ログを全文貼り付けるよう、お願いします。

思考するエンジニアのためのQ&Aサイト「teratail」について詳しく知る