繁体   English   中英

仅在 Documents 目录中运行 create-react-app 后,Npm 开始不起作用

[英]Npm start not working after running create-react-app ONLY in Documents directory

我一整天都在与这个问题作斗争,但仍然无法弄清楚我错过了什么。 我一直在计算机上的 Documents 目录下创建我的项目,但是在使用 create-react-app 后尝试启动项目时,我开始收到以下错误。

my-app@0.1.0 start C:\Users\{user}\Documents\B&R Fun\nginx_test_deploy\my-app

react-scripts start

'R' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'C:\Users\{user}\Documents\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 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\{user}\AppData\Roaming\npm-cache\_logs\2020-03-30T21_02_14_553Z-debug.log

有趣的是,在我的桌面上运行完全相同的命令会创建一个没有错误的应用程序。 是否有一些我遗漏的配置可能会影响在“文档”文件夹下创建的应用程序?

您应该尝试清除并重新安装 node_modules。 您可以通过运行以下命令来执行此操作。

rm -rf node_modules package-lock.json && npm install && npm start

此外,升级到更高版本的nodenpm

尝试重命名B&R Fun文件夹以避免出现与符号。 似乎&打破了一切。 看到这个问题

暂无
暂无

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

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