React-native installing required CocoaPods dependencies stuck - react-native

i cant finish react-native init as the process keep stuck at instaling required cocoapods dependencies please help
this is a few part what shown in terminal:
[4/4] πŸ“ƒ Building fresh packages...
success Saved lockfile.
success Saved 48 new dependencies.
β”œβ”€ #babel/core#7.5.0
β”œβ”€ #babel/runtime#7.5.0
β”œβ”€ #react-native-community/eslint-config#0.0.5
β”œβ”€ #types/eslint-visitor-keys#1.0.0
β”œβ”€ #typescript-eslint/eslint-plugin#1.11.0
β”œβ”€ #typescript-eslint/experimental-utils#1.11.0
β”œβ”€ #typescript-eslint/parser#1.11.0
β”œβ”€ #typescript-eslint/typescript-estree#1.11.0
β”œβ”€ acorn-jsx#5.0.1
β”œβ”€ acorn#6.2.0
β”œβ”€ ajv#6.10.0
β”œβ”€ babel-jest#24.8.0
β”œβ”€ chardet#0.7.0
β”œβ”€ doctrine#3.0.0
β”œβ”€ emoji-regex#7.0.3
β”œβ”€ eslint-scope#4.0.3
β”œβ”€ eslint-utils#1.3.1
β”œβ”€ eslint#6.0.1
β”œβ”€ espree#6.0.0
β”œβ”€ esquery#1.0.1
β”œβ”€ external-editor#3.0.3
β”œβ”€ file-entry-cache#5.0.1
β”œβ”€ flat-cache#2.0.1
β”œβ”€ flatted#2.0.1
β”œβ”€ functional-red-black-tree#1.0.1
β”œβ”€ glob-parent#3.1.0
β”œβ”€ ignore#4.0.6
β”œβ”€ import-fresh#3.1.0
β”œβ”€ inquirer#6.4.1
β”œβ”€ is-extglob#2.1.1
β”œβ”€ is-glob#4.0.1
β”œβ”€ jest#24.8.0
β”œβ”€ json-stable-stringify-without-jsonify#1.0.1
β”œβ”€ levn#0.3.0
β”œβ”€ lodash.unescape#4.0.1
β”œβ”€ metro-react-native-babel-preset#0.55.0
β”œβ”€ optionator#0.8.2
β”œβ”€ parent-module#1.0.1
β”œβ”€ path-dirname#1.0.2
β”œβ”€ progress#2.0.3
β”œβ”€ react-refresh#0.2.0
β”œβ”€ regexpp#2.0.1
β”œβ”€ rxjs#6.5.2
β”œβ”€ table#5.4.1
β”œβ”€ text-table#0.2.0
β”œβ”€ tslib#1.10.0
β”œβ”€ tsutils#3.14.0
└─ write#1.0.3
✨ Done in 19.41s.
info Installing required CocoaPods dependencies

Installing required CocoaPods dependencies takes time. Waiting for about 30mins worked for me.

Waiting for about 40mins worked for me. Installing required CocoaPods dependencies takes time. See my screenshot.

Break with Ctrl-C.
Enter cd ios
Run pod install --repo-update
But anyway it is not fast. Need wait because big repo cloned into fs under the hood.

Fixed with this - Open Xcode and go to Xcode β†’ Preferences β†’ Locations, and make sure the command line tools is set to the version of Xcode you’re using.

Install CocaPods
CocoaPods is a package management tool for iOS and macOS development. We use it to add the actual React Native framework code locally into your current project.
We recommend installing CocoaPods using Homebrew.
$ brew install cocoapods
or
sudo gem install cocoapods

You can try to disable iCloud, this helped me.

I was having the same issue. Solved by changing my internet connection from WIFI to mobile data. Then I ran the following commands which worked for me:
$ pod deintegrate
$ pod install
Hope this will work.

It took a while for CocoaPods installation and I got error at the end. podfile was inside iOS folder with no .xcworkspace. I did pod install again (in iOS folder) and all good. Please make sure CocoaPods is installed.

I think the main problem is mismatch version of CocoaPods and react native dependency. So you can try update Cocoapods
sudo gem install cocoapods
and then go inside your react native project in /ios folder then install pod again with
pod install

Related

Using GitHub Actions with a React/NodeJS + shared code monorepo

I'm writing an application split (at least for this repo) between a React frontend and an Express/NodeJS server.
Some of the code that I needed was used by both, so I split it into a third folder and used npm link to locally install it into the frontend and server folders.
shared-code/
β”œβ”€ dist/ // output of npm build (tsc)
β”œβ”€ src/
β”‚ β”œβ”€ index.ts // export const sharedFn = () => {}
β”œβ”€ tsconfig.json
β”œβ”€ package.json
β”œβ”€ package-lock.json
server/
β”œβ”€ dist/ // output of npm build
β”œβ”€ src/
β”‚ β”œβ”€ index.ts // import { sharedFn } from 'shared-code'
β”œβ”€ tsconfig.json
β”œβ”€ package.json
β”œβ”€ package-lock.json
frontend/
β”œβ”€ dist/ // output of npm build
β”œβ”€ src/
β”‚ β”œβ”€ index.ts // import { sharedFn } from 'shared-code'
β”œβ”€ tsconfig.json
β”œβ”€ package.json
β”œβ”€ package-lock.json
// in shared-code directory
npm run build
// in server directory
npm link ../shared-code
// produces in server/package.json
"dependencies": {
"express": "^4.18.2",
"shared-code": "file:../shared-code",
"ws": "^8.11.0"
},
The dist folders are generated by tsc (or npm run build, which for the frontend uses a CRA script) but are not stored in the repo. This seems to complicate the use of a GitHub action, since the shared-code/dist doesn't exist in a clean checkout, breaking naΓ―ve approaches to a separate script for each portion, and my attempts to use needs and a single yaml file.
I haven't been able to work out how to do this in a GitHub action, or how to approach this. I don't want to publish an npm package publicly, and my desired outcome would be to produce GitHub releases in a form that I can download them onto a remote device (by curl, wget, whatever) and then run them with node some/path/to/dist/index.js, chromium /some/path/to/dist/index.html. (But I'd say that all of deployment is not in the scope of this question - only writing in case it changes the suitable method.)

Using Vue3 and Vue2 simultaneously in monorepo

I have a problem building Vue3 and Vue2 apps in monorepo.
When trying to build the apps I see an error in Vue3 app:
error in ./src/App.vue
Syntax Error: TypeError: Cannot read properties of undefined (reading 'styles')
ERROR in ./src/App.vue
Module build failed (from ../../node_modules/#vue/cli-service/node_modules/vue-loader/dist/index.js):
TypeError: Cannot read properties of undefined (reading 'styles')
at Object.loader (../../node_modules/#vue/cli-service/node_modules/vue-loader/dist/index.js:70:34)
# ./src/main.ts 2:0-28 5:10-13
Monorepo tool: TurboRepo
Package manager: yarn v1
Vue3 version: 3.2.13
Vue2 version: 2.6.11
Vue3 cli version: 5.0.8
Vue2 cli version: 4.5.17
webpack for vue3: 5.54
webpack for vue2: 4.46
Folder structure
β”œβ”€ apps/
β”‚ β”œβ”€ vue3-app/
β”‚ β”‚ β”œβ”€ package.json
β”‚ β”œβ”€ vue2-app-1/
β”‚ β”‚ β”œβ”€ package.json
β”‚ β”œβ”€ vue2-app-2/
β”‚ β”‚ β”œβ”€ package.json
β”œβ”€ package.json
In the root package.json I declared workspaces
"workspaces": {
"packages": [
"apps/vue2-app-1",
"apps/vue2-app-2",
"apps/vue3-app"
],
I think it could be a problem with packages in root node_modules (Vue3 trying to use wrong package version?) so I tried yarn nohoist option but it didn't change anything
"nohoist": [
"vue3-app/**/vue",
"vue3-app/**/vue/**",
"vue2-app-1/**/vue/**",
"vue2-app-1/**/vue/**",
"vue2-app-2/**/vue/**",
"vue2-app-2/**/vue/**",
"vue3-app/**/vue-loader",
"vue3-app/**/vue-loader/**",
"vue2-app-1/**/vue-loader/**",
"vue2-app-1/**/vue-loader/**",
"vue2-app-2/**/vue-loader/**",
"vue2-app-2/**/vue-loader/**"
]
What could be causing the problem?

Configure gradle wrapper for all subprojects

I have the following monorepo structure:
root/
β”œβ”€ gradle/
β”‚ β”œβ”€ wrapper/
β”œβ”€ services/
β”‚ β”œβ”€ Consumer/
β”‚ β”‚ β”œβ”€ build.gradle.kts
β”‚ β”‚ β”œβ”€ settings.gradle.kts
β”‚ β”œβ”€ Reader/
β”‚ β”‚ β”œβ”€ build.gradle.kts
β”‚ β”‚ β”œβ”€ settings.gradle.kts
//... more services
β”œβ”€ gradle.properties
β”œβ”€ gradlew
β”œβ”€ gradlew.bat
I would like to keep the Gradle Wrapper at the top level. However, when I'm trying to import a single service into Intellij, I have to reconfigure the Gradle and provide gradle wrapper path.
I have seen there is an option to define gradle path by calling gradle wrapper task.
Is it possible somehow to configure the wrapper path as part of settings.gradle.kts in each service I have so me or other project members have to remember about changing IDE settings?

Error starting project with create-react-native-app using yarn

I started working on create-react-native-app.
Installed it using " sudo yarn global add create-react-native-app#1.0.0" with the following logs.
zadmin#zadmin-Vostro-3446:~$ sudo yarn global add create-react-native-app#1.0.0
[sudo] password for zadmin:
yarn global v1.10.1
warning package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-react-native-app#1.0.0" with binaries:
- create-react-native-app
Done in 2.24s.
created a sub directory ReactNative and started too scaffold out the React Native application at the convenient location with the following logs:
zadmin#zadmin-Vostro-3446:~/Desktop/coursera$ cd ReactNative/
zadmin#zadmin-Vostro-3446:~/Desktop/coursera/ReactNative$ dir
zadmin#zadmin-Vostro-3446:~/Desktop/coursera/ReactNative$ create-react-native-app confusion
Creating a new React Native app in /home/zadmin/Desktop/coursera/ReactNative/confusion.
Using package manager as yarnpkg with yarn interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...
yarn add v1.10.1
warning ../../../../package.json: No license field
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 20 new dependencies.
info Direct dependencies
└─ react-native-scripts#2.0.1
info All dependencies
β”œβ”€ ansi-styles#3.2.1
β”œβ”€ babel-runtime#6.26.0
β”œβ”€ chalk#2.4.1
β”œβ”€ color-convert#1.9.3
β”œβ”€ color-name#1.1.3
β”œβ”€ core-js#2.5.7
β”œβ”€ cross-spawn#5.1.0
β”œβ”€ escape-string-regexp#1.0.5
β”œβ”€ has-flag#3.0.0
β”œβ”€ isexe#2.0.0
β”œβ”€ lru-cache#4.1.3
β”œβ”€ minimist#1.2.0
β”œβ”€ pseudomap#1.0.2
β”œβ”€ react-native-scripts#2.0.1
β”œβ”€ regenerator-runtime#0.11.1
β”œβ”€ shebang-command#1.2.0
β”œβ”€ shebang-regex#1.0.0
β”œβ”€ supports-color#5.5.0
β”œβ”€ which#1.3.1
└─ yallist#2.1.2
Done in 2.98s.
(node:18277) UnhandledPromiseRejectionWarning: Error: Cannot find module '/home/zadmin/Desktop/coursera/ReactNative/confusion/node_modules/react-native-scripts/build/scripts/init.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at _callee2$ (/usr/local/share/.config/yarn/global/node_modules/create-react-native-app/build/index.js:128:32)
at tryCatch (/usr/local/share/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (/usr/local/share/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (/usr/local/share/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:114:21)
at step (/usr/local/share/.config/yarn/global/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /usr/local/share/.config/yarn/global/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
(node:18277) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18277) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
then moved into the created app i.e., confusion and attempting to start the yarn, it isn't starting with the following logs:
zadmin#zadmin-Vostro-3446:~/Desktop/coursera/ReactNative$ cd confusion/
zadmin#zadmin-Vostro-3446:~/Desktop/coursera/ReactNative/confusion$ yarn start
yarn run v1.10.1
warning ../../../../package.json: No license field
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Please help me to troubleshoot this issue!
According to the new docs at https://github.com/react-community/create-react-native-app,
Note: Create React Native App has been merged with Expo CLI You can
now use expo init to create your project. See Quick Start in the Expo
documentation for instructions on getting started using Expo CLI.
Thus you should be using the Expo CLI. A Quick getting started can be found at https://github.com/react-community/create-react-native-app#quick-overview
Installation Guide for Expo CLI

How to view the dependency tree of a given npm module?

How can I get the tree of a module available to npm, but not installed locally ?
npm ll does the job for locally installed packages. But it doesn't work for modules not installed or modules installed globally.
I tried npm list bower but that's not it.
You can generate NPM dependency trees without the need of installing
a dependency by using the command
npm list
This will generate a dependency tree for the project at the current directory and print it to the console.
You can get the dependency tree of a specific dependency like so:
npm list [dependency]
You can also set the maximum depth level by doing
npm list --depth=[depth]
Note that you can only view the dependency tree of a dependency that you have installed either globally, or locally to the NPM project.
You can use the npm-remote-ls module. You can install it globally:
npm install -g npm-remote-ls
And then call:
npm-remote-ls bower
Alternatively, npm#5.2.0 installed then you can use npx and avoid globally installing the command - just call:
npx npm-remote-ls bower
This site allows you to view a packages tree as a node graph in 2D or 3D.
http://npm.anvaka.com/#/view/2d/waterline
Great work from #Avanka!
Here is the unpowerful official command:
npm view <PACKAGE> dependencies
It prints only the direct dependencies, not the whole tree.
You can use howfat which also displays dependency statistics:
npx howfat jasmine
If you want to get the actually dependency path of specific package and want to know why you have it, you can simply ask yarn why <MODULE>.
example:
$> yarn why mime-db
yarn why v1.5.1
[1/4] Why do we have the module "mime-db"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "mime-db#1.37.0"
info Reasons this module exists
- "coveralls#request#mime-types" depends on it
- Hoisted from "coveralls#request#mime-types#mime-db"
info Disk size without dependencies: "196kB"
info Disk size with unique dependencies: "196kB"
info Disk size with transitive dependencies: "196kB"
info Number of shared dependencies: 0
Done in 0.65s.
View All the metadata about npm module
npm view mongoose(module name)
View All Dependencies of module
npm view mongoose dependencies
View All Version or Versions module
npm view mongoose version
npm view mongoose versions
View All the keywords
npm view mongoose keywords
This command output all modules with dependencies in a tree structure:
npm ls -a
If you are using yarn, then you can go with yarn list from the root directory of the project. It'll give you a tree like structure of all the transitive dependencies like below:
β”œβ”€ #ampproject/toolbox-core#2.7.4
β”‚ β”œβ”€ cross-fetch#3.0.6
β”‚ └─ lru-cache#6.0.0
β”œβ”€ #ampproject/toolbox-optimizer#2.7.0-alpha.1
β”‚ β”œβ”€ #ampproject/toolbox-core#^2.6.0
β”‚ β”œβ”€ #ampproject/toolbox-runtime-version#^2.7.0-alpha.1
β”‚ β”œβ”€ #ampproject/toolbox-script-csp#^2.5.4
β”‚ β”œβ”€ #ampproject/toolbox-validator-rules#^2.5.4
β”‚ β”œβ”€ abort-controller#3.0.0
β”‚ β”œβ”€ cross-fetch#3.0.5
β”‚ β”œβ”€ cross-fetch#3.0.5
β”‚ β”‚ └─ node-fetch#2.6.0
β”‚ β”œβ”€ cssnano-preset-simple#1.2.0
β”‚ β”‚ β”œβ”€ caniuse-lite#^1.0.30001093
β”‚ β”‚ β”œβ”€ postcss#^7.0.32
β”‚ β”‚ └─ postcss#7.0.35
β”‚ β”‚ β”œβ”€ chalk#^2.4.2
β”‚ β”‚ β”œβ”€ source-map#^0.6.1
β”‚ β”‚ └─ supports-color#^6.1.0
To get it as a list:
% npx npm-remote-ls --flatten dugite -d false -o false
[
'dugite#1.91.3',
'checksum#0.1.1',
'progress#2.0.3',
'mkdirp#0.5.5',
'rimraf#2.7.1',
'tar#4.4.13',
'optimist#0.3.7',
'got#9.6.0',
'minimist#1.2.5',
'chownr#1.1.4',
'glob#7.1.6',
'fs-minipass#1.2.7',
'minizlib#1.3.3',
'minipass#2.9.0',
'safe-buffer#5.2.1',
'yallist#3.1.1',
'wordwrap#0.0.3',
'#szmarczak/http-timer#1.1.2',
'cacheable-request#6.1.0',
'#sindresorhus/is#0.14.0',
'decompress-response#3.3.0',
'duplexer3#0.1.4',
'lowercase-keys#1.0.1',
'mimic-response#1.0.1',
'get-stream#4.1.0',
'to-readable-stream#1.0.0',
'p-cancelable#1.1.0',
'url-parse-lax#3.0.0',
'fs.realpath#1.0.0',
'inflight#1.0.6',
'inherits#2.0.4',
'once#1.4.0',
'path-is-absolute#1.0.1',
'minimatch#3.0.4',
'defer-to-connect#1.1.3',
'clone-response#1.0.2',
'get-stream#5.2.0',
'http-cache-semantics#4.1.0',
'lowercase-keys#2.0.0',
'responselike#1.0.2',
'keyv#3.1.0',
'pump#3.0.0',
'prepend-http#2.0.0',
'normalize-url#4.5.0',
'wrappy#1.0.2',
'brace-expansion#1.1.11',
'json-buffer#3.0.0',
'end-of-stream#1.4.4',
'concat-map#0.0.1',
'balanced-match#1.0.0'
]
There is also a nice web app to see the dependencies in a weighted map kind of view.
For example:
https://bundlephobia.com/result?p=sanitize-html#1.19.1
Unfortunately npm still doesn't have a way to view dependencies of non-installed packages. Not even a package's page list the dependencies correctly. πŸ™„
Luckily installing yarn:
brew install yarn
Allows one to use its info command to view accurate dependencies:
yarn info #angular/router#4.4.7 dependencies
yarn info #angular/router#4.4.7 peerDependencies