简体   繁体   English

我不能使用“create-react-app”(“这与 npm 找不到文件有关。”)

[英]I can't use "create-react-app" ("This is related to npm not being able to find a file.")

I tried every single thing I've found, but I just can't run create-react-app.我尝试了我发现的每一件事,但我无法运行 create-react-app。 I tried to uninstall node and install again, use yarn, clean cache, create with "npm init..." but nothing works.我尝试卸载节点并再次安装,使用纱线,清理缓存,使用“npm init ...”创建,但没有任何效果。

Microsoft Windows [versão 10.0.19043.1889]
(c) Microsoft Corporation. Todos os direitos reservados.

C:\Program Files (x86)\Windows Resource Kits\Tools>cd C:\Users\user\meu_app

C:\Users\user\meu_app>node -v
v16.17.0

C:\Users\user\meu_app>npm -v
8.18.0

C:\Users\user\meu_app>npx create-react-app myapp
npm ERR! code ENOENT
npm ERR! syscall spawn C:\Users\user
npm ERR! path C:\Users\user\meu_app
npm ERR! errno -4058
npm ERR! enoent spawn C:\Users\user ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-09-02T19_06_17_314Z-debug-0.log

I have never seen this issue before.我以前从未见过这个问题。 npx is distributed with npm 5.2+, so that shouldn't be the issue. npx 与 npm 5.2+ 一起分发,所以这不应该是问题。 It seems your issue is similar to this one Can't install any NPM package, error 4058看来您的问题与此类似Can't install any NPM package,错误 4058

Try these steps:尝试以下步骤:

  • Delete package-lock.json and run NPM again (probably can skip this one if it does not pertain to your issue)删除 package-lock.json 并再次运行 NPM (如果它与您的问题无关,可能可以跳过此)
  • Ensure no other processes of node.js are running (check task manager)确保 node.js 没有其他进程正在运行(检查任务管理器)
  • If you are using visual studio code, close it and try running npm install again.如果您使用的是 Visual Studio 代码,请将其关闭并尝试再次运行 npm 安装。
  • If all else fails, restart your computer.如果所有其他方法都失败,请重新启动计算机。

See thread here: https://github.com/npm/npm/issues/17444请参阅此处的线程: https://github.com/npm/npm/issues/17444

Let me know if that helps;让我知道这是否有帮助; otherwise, I will keep looking.否则,我会继续寻找。

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

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