質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

React Native

React Nativeは、ネイティブモバイルアプリ(iOS/Android)を作成できるJavaScriptフレームワークです。Reactと同じ設計のため、宣言的なコンポーネントでリッチなUIを開発することが可能です。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Q&A

解決済

1回答

727閲覧

macOSにexpo-cliをインストールしたい

menma275

総合スコア3

npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

React Native

React Nativeは、ネイティブモバイルアプリ(iOS/Android)を作成できるJavaScriptフレームワークです。Reactと同じ設計のため、宣言的なコンポーネントでリッチなUIを開発することが可能です。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

0グッド

0クリップ

投稿2023/02/14 00:03

実現したいこと

macOSにReact NativeのためのExpo CLIをインストールしたいです。

環境

macOS Ventura : 13.1
Node.js : 18.12.1

発生している問題・エラーメッセージ

以下のようなエラーが出ました。

% npm install --global expo-cli npm ERR! code EACCES npm ERR! syscall rename npm ERR! path /usr/local/lib/node_modules/expo-cli npm ERR! dest /usr/local/lib/node_modules/.expo-cli-dKBr48UN npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN' npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'rename', npm ERR! path: '/usr/local/lib/node_modules/expo-cli', npm ERR! dest: '/usr/local/lib/node_modules/.expo-cli-dKBr48UN' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /Users/username/.npm/_logs/2023-02-13T23_45_26_960Z-debug-0.log

試したこと

「It is likely you do not have the permissions to access this file as the current user」とあったので
sudoで実行を試しましたが、以下のようなエラーが出ます。

% sudo npm install --global expo-cli npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. changed 1178 packages, and audited 1179 packages in 2m 102 packages are looking for funding run `npm fund` for details 17 vulnerabilities (3 moderate, 14 high) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details. % npm audit npm ERR! code ENOLOCK npm ERR! audit This command requires an existing lockfile. npm ERR! audit Try creating one first with: npm i --package-lock-only npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file npm ERR! A complete log of this run can be found in: npm ERR! /Users/username/.npm/_logs/2023-02-13T23_58_45_760Z-debug-0.log % npm audit fix npm ERR! code ENOLOCK npm ERR! audit This command requires an existing lockfile. npm ERR! audit Try creating one first with: npm i --package-lock-only npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file npm ERR! A complete log of this run can be found in: npm ERR! /Users/username/.npm/_logs/2023-02-13T23_59_24_969Z-debug-0.log

追記

お知恵をお貸しいただけると助かります。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

symfo

2023/02/14 00:49

知識のない素人さんが意味もわからずsudoを乱用。 書き込みエラー頻発。 >お知恵をお貸し 基本から勉強して知恵をつけましょう。
AbeTakashi

2023/02/14 01:31 編集

"uuid@3.4.0: Please upgrade to version 7 or higher."と出てますよ。 こちら対応されましたか? あと /Users/username/.npm/_logs/2023-02-13T23_58_45_760Z-debug-0.log とログも出てるので、そちらも確認すべきかと思います。
guest

回答1

0

ベストアンサー

>試したこと
>% sudo npm install --global expo-cli

MacOSの場合、/usr/local配下のディレクトリやファイルの所有者は一般ユーザです。
sudoをつけてインストールすると、それらの所有者はrootになってしまいます。
以降、一般ユーザで何か作業しようとすると書き込みエラー(you do not have the permissions)になります。

>% npm install --global expo-cli
>npm ERR! code EACCES

chownコマンドなど使って、所有者をrootから一般ユーザに戻してください。

投稿2023/02/14 02:11

technocore

総合スコア7225

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

menma275

2023/02/14 03:16

回答ありがとうございます。 sudoの扱いについてよく理解しておりませんでした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問