簡體   English   中英

create-react-app 無法正常工作並且需要永遠,有什么建議嗎?

[英]create-react-app is not working and it's taking forever, any suggestions?

我剛剛完成了一門 React 課程,想開始練習。 但是,我似乎無法使用 create-react-app 啟動項目。

當我在命令行中使用create-react-app projectname時,它開始安裝,但它需要半小時才能最終放棄並向我顯示一堆我似乎無法理解的錯誤。 當我觀看有關如何使用 create-react-app 的教程時,它似乎應該可以正常工作並且應該在大約 12 秒內完成。

我已經嘗試了很多事情:

  • 檢查是否安裝了 npm、node 和 npx
  • 以管理員身份運行 CMDer(我使用的 CLI)
  • npm install -g create-react-app 后跟 create-react-app 項目名稱
  • npm install -g create-react-app 后跟 npm create-react-app 項目名稱
  • npm init react-app 項目名稱
  • 卸載 create-react-app 並重新安裝
  • npx create-react 應用程序項目名稱
  • 禁用我的防火牆和防病毒軟件並執行上述所有操作
  • 清除 npm 緩存
  • 將 npm 更新到最新版本

這是我日志的最后一部分,最重要的是這只是一堆愚蠢的 SaveTree 行。

28892 silly saveTree `-- react@16.8.6
28893 warn ts-pnp@1.0.1 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
28894 verbose stack Error: EPERM: operation not permitted, rename 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\eslint-module-utils' -> 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\.eslint-module-utils.DELETE'
28895 verbose cwd C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest
28896 verbose Windows_NT 6.1.7601
28897 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
28898 verbose node v10.15.3
28899 verbose npm  v6.4.1
28900 error path C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\eslint-module-utils
28901 error code EPERM
28902 error errno -4048
28903 error syscall rename
28904 error Error: EPERM: operation not permitted, rename 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\eslint-module-utils' -> 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\.eslint-module-utils.DELETE'
28904 error  { [Error: EPERM: operation not permitted, rename 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\eslint-module-utils' -> 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\.eslint-module-utils.DELETE']
28904 error   cause:
28904 error    { Error: EPERM: operation not permitted, rename 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\eslint-module-utils' -> 'C:\Users\Dave\MyProjects\Portfolio\Tickomatic\newest\node_modules\.eslint-module-utils.DELETE'
28904 error      errno: -4048,
28904 error      code: 'EPERM',
28904 error      syscall: 'rename',
28904 error      path:
28904 error       'C:\\Users\\Dave\\MyProjects\\Portfolio\\Tickomatic\\newest\\node_modules\\eslint-module-utils',
28904 error      dest:
28904 error       'C:\\Users\\Dave\\MyProjects\\Portfolio\\Tickomatic\\newest\\node_modules\\.eslint-module-utils.DELETE' },
28904 error   stack:
28904 error    'Error: EPERM: operation not permitted, rename \'C:\\Users\\Dave\\MyProjects\\Portfolio\\Tickomatic\\newest\\node_modules\\eslint-module-utils\' -> \'C:\\Users\\Dave\\MyProjects\\Portfolio\\Tickomatic\\newest\\node_modules\\.eslint-module-utils.DELETE\'',
28904 error   errno: -4048,
28904 error   code: 'EPERM',
28904 error   syscall: 'rename',
28904 error   path:
28904 error    'C:\\Users\\Dave\\MyProjects\\Portfolio\\Tickomatic\\newest\\node_modules\\eslint-module-utils',
28904 error   dest:
28904 error    'C:\\Users\\Dave\\MyProjects\\Portfolio\\Tickomatic\\newest\\node_modules\\.eslint-module-utils.DELETE',
28904 error   parent: 'newest' }
28905 error The operation was rejected by your operating system.
28905 error It's possible that the file was already in use (by a text editor or antivirus),
28905 error or that you lack permissions to access it.
28905 error
28905 error If you believe this might be a permissions issue, please double-check the
28905 error permissions of the file and its containing directories, or try running
28905 error the command again as root/Administrator (though this is not recommended).
28906 verbose exit [ -4048, true ]

據我所知,它與無法重命名某個文件和我的操作系統(在我的情況下為 Windows)因此拒絕整個事情有關。 我不確定這是否正確,但這就是我所能弄清楚的,我不確定如何解決這個問題。

有什么建議? 我似乎無法為此找到解決方案,而且我對 WebPack 不熟悉,因此目前無法手動設置項目。

提前致謝,

戴夫

如果您正在使用 dropbox 或類似的同步目錄的東西,則可能會導致此問題。

還嘗試使用以下方法更新 npm:

npm install -g npm@latest

我通過以下方式全局更新了create-react-app

npm install -g create-react-app

它解決了我的問題。 但是,我對 npm 使用 6.9.0 版本,對 node 使用 12.5.0 版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM