在尝试使用 npx create-react-app 创建新的 React 应用程序时,我遇到了一个持续存在的问题。在我的项目目录中。尽管执行了多个故障排除步骤,我仍然收到与 npm 路径相关的 ENOENT 错误。
当我尝试使用 GitBash 在我的项目目录中使用 ( npx create-react-app .) 创建新的 React 应用程序时,遇到了一个持续存在的问题。尽管执行了几个故障排除步骤:
这是以下错误消息:
npm error code ENOENT
npm error syscall lstat
npm error path C:\Users\<username>\AppData\Roaming\npm
npm error errno -4058
npm error enoent ENOENT: no such file or directory, lstat 'C:\Users\<username>\AppData\Roaming\npm'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
似乎您还没有全局安装
npm
。尝试使用
npm install npm -g
从你的目录中,之后它应该可以工作。