我是 react js 的新手。當我想創建-react-app-todos-list 時,它正在創建但不顯示成功訊息。結果,當我使用 npm start 命令時,它顯示錯誤。所以請幫助我修復此錯誤。
//當我使用 create-react-app todos-list 時,它在 vscode 中顯示以下內容
npx create-react-app todos-list
Creating a new React app in D:\react\todos-list.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1357 packages in 1m
166 packages are looking for funding
run `npm fund` for details
//當我使用 npm start 命令時,它顯示如下
PS D:\react> npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\react/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\react\package.json'
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\shaik\AppData\Local\npm-cache\_logs\2022-01-14T14_29_47_642Z-debug.log
PS D:\react>
**我嘗試過的解決方案
For create-react-app**
npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f
and SKIP_PREFLIGHT_CHECK=true
uj5u.com熱心網友回復:
您不在todos-list目錄中: PS D:\react>
型別:cd todos-list那么npm start
uj5u.com熱心網友回復:
當您使用創建反應應用程式時,npx create-react-app您可以選擇像您所做的那樣命名您的專案npx create-react-app todos-list,另一個選項是在當前目錄中創建應用程式npx create-react-app .
您的問題來自您命名專案,現在您必須顯式導航到專案的目錄,因為 package.json 位于該目錄中。package.json 是必不可少的,因為它包含運行應用程式所需的所有腳本。
如果您在同一個控制臺上,您只需鍵入:
cd todos-list
接著:
npm start
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/411274.html
標籤:
上一篇:運行命令“npmrunbuild”時出錯,錯誤“TypeError:MiniCssExtractPlugin不是建構式”
下一篇:Meteor全球版本與專案不同
