You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已安装Node及依赖,执行create-expo-app遇ENOENT错误求助

解决npx create-expo-app报错ENOENT的问题

执行的命令:

C:\Users\Abdul Ghani>npx create-expo-app@latest --template tabs@49

触发的错误信息:

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\Abdul Ghani\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Abdul Ghani\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

问题根源

npm无法找到全局安装目录C:\Users\Abdul Ghani\AppData\Roaming\npm,大概率是该目录被误删除或从未自动创建。

解决步骤

  • 手动创建缺失目录

    1. 打开文件资源管理器,导航到C:\Users\Abdul Ghani\AppData\Roaming路径
    2. 新建名为npm的文件夹
    3. 重新运行项目创建命令
  • 重置npm配置

    1. 以管理员身份启动CMD或PowerShell
    2. 执行命令指定npm前缀目录:npm config set prefix "C:\Users\Abdul Ghani\AppData\Roaming\npm"
    3. 清理npm缓存:npm cache clean --force
    4. 再次尝试运行npx create-expo-app@latest --template tabs@49
  • 重新安装npm(若前两步无效)

    1. 卸载全局npm:npm uninstall -g npm
    2. 安装最新版全局npm:npm install -g npm@latest
    3. 完成后重新执行项目创建命令

内容的提问来源于stack exchange,提问作者Abdul Ghani Khan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 04:43:18