![](/img/trans.png)
[英]Invariant-Violation and Uncaught-error while setting up navigation in react-native app
[英]An error occurred while setting up a new react-native project
我是 React-native 的新手。我正在嘗試設置一個沒有 expo 的 react-native 項目並使用 Typescript 但出了點問題,我不明白是什么導致了錯誤。
這是我運行命令時的終端內容:npx react-native init MyApp --template react-native-template-typescript
###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing Bundler
error /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21: warning: Insecure world writable dir /usr/local/mongodb in PATH, mode 040777
✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
at createFromTemplate (/Users/phamthanhphuc/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:169:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.initialize [as func] (/Users/phamthanhphuc/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:222:3)
at async Command.handleAction (/Users/phamthanhphuc/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js:140:9)
info Run CLI with --verbose flag for more details.
請幫我! 謝謝您的幫助!
您將需要具有根訪問權限才能執行此操作。 如果您還不是管理用戶,請以管理員身份登錄。 然后使用“sudo”更改權限:
sudo chmod go -w /usr/local/bin
顯然,這將意味着你不能再在 /usr/local/bin 中安裝材料,除非通過“sudo”,但你可能不應該這樣做。
要么
您需要設置 ios 環境路徑請選擇此鏈接: https://reactnative.dev/docs/environment-setup
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.