![](/img/trans.png)
[英]Getting error Cannot find module 'cryptile' while installing express js
[英]Error while installing React - "Cannot find module 'block-stream'
這是執行的行:
PS E:\React_js> npx create-react-app React_js node:internal/modules/cjs/loader:942 throw err; ^
錯誤告訴找不到模塊:
Error: Cannot find module 'block-stream' Require stack: at Module._resolveFilename (node:internal/modules/cjs/loader:939:15) at Module._load (node:internal/modules/cjs/loader:780:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (C:\Users\DELL\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\tar-pack\node_modules\tar\lib\entry-writer.js:7:19) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\tar-pack\\node_modules\\tar\\lib\\entry-writer.js', 'C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\tar-pack\\node_modules\\tar\\lib\\pack.js', 'C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\tar-pack\\node_modules\\tar\\tar.js', 'C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\tar-pack\\index.js', 'C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\create-react-app\\createReactApp.js', 'C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\c67e74de0542c87c\\node_modules\\create-react-app\\index.js' ]
我已經嘗試在 VS 和 cmd 上執行它
Nodejs 版本 v18.0.0
這可能很難調試,因為可能存在很多問題。 我建議按照關於create-react-app
的文檔返回第一步
正如文檔所述,如果您已全局安裝它,則需要刪除create-react-app
以確保您擁有最新版本。 您可以像這樣檢查全局安裝的軟件包:
npm list -g create-react-app
如果它是全局安裝的,請運行卸載命令將其刪除:
npm uninstall -g create-react-app
從這里您可以使用 npx 重復文檔中的步驟。
或者,您可以嘗試僅使用 npm,而不是使用npx
:
npm install create-react-app && create-react-app React_js
如果這不起作用,您可以隨時嘗試使用紗線構建
如果你運行npm install create-react-app && create-react-app React_js
,請確保你再次運行npm list -g create-react-app
試試這個:
1.Go 到您的_npx
目錄並刪除c67e74de0542c87c
文件(在您的情況下:)
cd C:\\Users\\DELL\\AppData\\Local\\npm-cache\\_npx\\
rmdir c67e74de0542c87c
2.運行:
npx create-react-app
3.輸入y
提示:
Need to install the following packages:
create-react-app@5.0.1
Ok to proceed? (y) y
create-react-app
現在應該可以工作了。
我在終端上運行了“npm i block-stream”。
然后在我的項目文件夾中運行“npx create-react-app”,這對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.