如何修复 React Native 中的 'npm start' 错误?

How do I fix the 'npm start' error in React Native?

当我在 VS Code 的终端中输入 npm start 时,结果如下:

PS C:\Windows\System32\FirstApp> npm start

> @ start C:\Windows\System32\FirstApp
> expo start

EPERM: operation not permitted, open 'C:\Windows\System32\FirstApp\.expo\settings.json.1281830730'
Error: EPERM: operation not permitted, open 'C:\Windows\System32\FirstApp\.expo\settings.json.1281830730'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hatfi\AppData\Roaming\npm-cache\_logs21-09-07T14_06_40_219Z-debug.log

我在互联网上四处寻找,但我不知道如何修复它,我尝试的任何其他修复似乎都不起作用,除了卸载并重新安装 node.js,但我已经这样做了下次我关闭 PC 时,这种情况会再次发生。

要在 System32 文件夹中写入文件,您需要管理员权限。 所以或者你 运行 shell “作为管理员”,或者你最好更改你的应用程序的目录。
在该目录中创建项目没有任何意义。

请不要使用system32文件夹

system32文件夹是Windows使用的系统文件夹。您真的不应该将该文件夹用于任何用途。如果你破坏了那个文件夹中的任何东西,你的系统很容易出现故障,你将不得不修复你的系统。

您收到错误的原因是,Windows 不鼓励用户使用您的系统文件夹,并在其中进行写入操作的“管理员检查”。

您可以在您的 Documents 文件夹中创建一个名为 Projects 的文件夹,然后将该文件夹用于您未来的项目。

希望答案清楚。