【发布时间】:2021-08-10 06:06:53
【问题描述】:
我是 react-native 的新手,当我尝试启动 npm start 命令然后向我显示 'expo-cli' is not recognized as an internal or external command, 这个错误时,我正在尝试在所有软件包安装后设置我的项目。
好的,那我已经按照here的指南进行操作了
之后我以这种方式添加了我的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
【问题讨论】:
-
这似乎是权限错误。确保运行代码的用户有足够的权限运行全局安装的包
-
@AbirTaher,是的,你能告诉我如何解决这个问题
标签: javascript node.js react-native npm expo