簡體   English   中英

使用create-react-app - ENOENT時出錯

[英]Error while using create-react-app - ENOENT

新節點和React用戶在這里。 我正在關注React教程,但在我的Windows 10機器上遇到了問題:

C:\Users\Wout>create-react-app my-app

Creating a new React app in C:\Users\Wout\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! path C:\Users\Wout\my-app\node_modules\abab
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Wout\my-app\node_modules\abab' -> 'C:\Users\Wout\my-app\node_modules\.abab.DELETE'
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\Wout\AppData\Roaming\npm-cache\_logs\2018-03-14T15_21_11_867Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting my-app / from C:\Users\Wout
Done.

到目前為止我嘗試過的事情:

  • 重新安裝Node.js(v8.10.0,npm 5.6.0)
  • 禁用Adobe廣告素材雲同步及相關流程(這些都是產生node.exe進程)
  • 在管理員中運行CMD
  • 從VS Code Powershell運行命令
  • 在執行命令之前關閉Visual Studio代碼
  • 使用npx運行該命令
  • 多次重啟系統
  • 從用戶文件夾以及其他驅動器運行命令
  • 運行Typescript版本: create-react-app my-app --scripts-version=react-scripts-ts

這對我來說很奇怪,因為在Mac OS X上,命令執行沒有問題。 我似乎也找不到其他人有同樣的問題。

對於它的價值,它總是在這個“敲定abab”包裝步驟之后停止。

我安裝了運行Apache和MySQL服務的XAMPP,不知道是否與它有任何關系。 我不這么認為,因為我還沒有運行應用程序,加上服務器無論如何都在端口3000上運行。

我最終通過關閉盡可能多的額外進程來解決它。 將嘗試找出干擾命令的進程。

編輯:丁丁鼎! 這是MalwareBytes! “實時保護30天試用版”在更新后重新啟動,並且正在調整文件系統。

我也剛剛安裝了MalWareBytes,我也得到了同樣的錯誤。 我嘗試以CLI身份運行create-react-app作為管理員,在運行時我會閱讀您的解決方案,因此我在安裝過程中關閉了MalWareBytes。

它工作正常,但我不知道這是因為我是以管理員身份運行,還是因為我關閉了MalWareBytes。

但對於遇到此問題的任何人,您還可以嘗試使用管理員權限運行命令提示符/ powershell。

嘗試從項目目錄運行命令...為我工作。 我從項目目錄的父目錄運行命令,例如:reactApp / hellowworld從helloworle目錄運行而不是...

如果您剛剛安裝了create-react-app命令,請嘗試從新終端運行該命令。 (重新打開另一個標簽)。

暫無
暫無

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

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