繁体   English   中英

无法安装 expo-cli -g

[英]Can't install expo-cli -g

我是 react-native 的新手,当我尝试启动npm start命令时,我正在尝试在所有 package 安装后设置我的项目,然后显示'expo-cli' is not recognized as an internal or external command,错误。

好的,那么我已经按照这里的指南进行操作

之后我以这种方式添加了我的env path

environment variable >  System Variables > PATH >
C:\Users\YOUR_USERNAME\AppData\Roaming\npm

然后我必须再次安装:

npm install -g expo-cli

但它对我不起作用,我不知道为什么。

当我尝试运行此命令npm install -g expo-cli然后显示如下错误:

PS C:\Users\alami\OneDrive\Desktop\React native\starter-react-native> npm install -g expo-cli
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\expo-cli
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\expo-cli'     
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\expo-cli'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\Program Files\\nodejs\\node_modules\\expo-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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!     C:\Users\alami\AppData\Local\npm-cache\_logs\2021-05-21T00_58_34_585Z-debug.log

至少我刚刚以这种方式解决了我的问题:

  1. 搜索cmd
  2. 然后以管理员身份运行
  3. 然后npm i -g expo-cli

我刚刚解决了我的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM