Create Ionic framework 4 Project - npm

I have globally installed the latest version of Ionic CLI 4 (4.12.0) by running npm install -g ionic#4.12.0, after that, I created a new Ionic project using ionic start, I opened the project and checked my package.json file :
"dependencies": {
"#angular/common": "~9.1.6",
"#angular/core": "~9.1.6",
"#angular/forms": "~9.1.6",
"#angular/platform-browser": "~9.1.6",
"#angular/platform-browser-dynamic": "~9.1.6",
"#angular/router": "~9.1.6",
"#ionic-native/core": "^5.0.7",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^5.0.0",
"rxjs": "~6.5.1",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
}
And as you can see, Ionic version installed is "5". Any suggestions to create Ionic 4 project instead of Ionic 5 project?
ionic --version: 4.12.0.
Thank you.

If you really want to use Ionic 4, you can install a specific version of any package by adding #[version] after the package name, so in your case for #ionic/angular, you need #ionic/angular#4.11.10.
In your project root, run:
npm i #ionic/angular#4.11.10
(version 4.11.10 is the LTS)

I'm working with ionic for 2 years and as I know, v5 and v4 have no difference in syntax or compatibility so you can use v5 and not worry about a thing.

Related

Is react-navigation compatible with react-native-macos?

I've created a fresh new React Native MacOS app and added in react-navigation. I am using React-Native 0.64 as the MacOS guide notes that it is the latest compatible version of React Native for react-native-macos.
I have the following dependencies installed via npm
"dependencies": {
"#react-native-community/masked-view": "^0.1.11",
"#react-navigation/native": "^6.0.12",
"#react-navigation/native-stack": "^6.8.0",
"react": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "^2.6.0",
"react-native-macos": "^0.64.30",
"react-native-reanimated": "^2.10.0",
"react-native-safe-area-context": "^4.3.3",
"react-native-screens": "^3.17.0",
"react-navigation-stack": "^2.10.4"
},
When I try to install the react-navigation packages and follow up with the pod-install command we see the following:
$ pod --version
1.11.3
$ pod install
Auto-linking React Native modules for target `slidesmacos-iOS`: RNCMaskedView, RNGestureHandler, RNReanimated, RNScreens, and react-native-safe-area-context
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "react-native-safe-area-context":
In Podfile:
react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
Is react-navigation available for react-native-macos?
It seems that you didn't install or the CocoaPods can't find a valid local installation for that lib (react-native-safe-area-context).
You can search what libs can be used for each platform at this website (with the flag ?macos=true) and the react-navigation is one of the recommended ones.
About your problem, did you follow up on all the steps from the install guide? It was mentioned about dependencies for Expo managed and Bare projects. The idea of it is that you need to install 2 more dependencies and one of them is what is missing:
react-native-screens
react-native-safe-area-context
There is also this answer to a similar question where the steps to fix are just some updates. One comment to that answer also stated that it was necessary to run pod repo update or pod install --repo-update. This could also help you.

Install Bootstrap 5.0.0. Alpha 2 from package.json [duplicate]

This question already has answers here:
How do I install package.json dependencies in the current directory using npm
(4 answers)
Closed 2 years ago.
Here's what I have in my current package.json
{
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.5.0",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"resolve-url-loader": "^3.1.0"
}
}
But I would like to run the latest Bootstrap version, which is 5.0.0. Alpha 2. How do I indicate that according to package.json syntax?
Just install the Bootstrap version you want using npm:
npm install bootstrap#5.0.0-alpha2
EDIT: to specify bootstrap 5.0.0 Alpha 2 in your package.json do this
"bootstrap": "^5.0.0-alpha2",

package.json inside react-native folder

I downloaded a react-native application from a git repository. Inside it, there is a file called package.json that looks like this:
"dependencies": {
"expo": "^27.0.0",
"invariant": "^2.2.4",
"react": "16.3.1",
"react-native": "^0.55.0",
"react-native-iphone-x-helper": "^1.0.2",
"react-navigation": "link:../..",
"react-navigation-header-buttons": "^0.0.4",
"react-navigation-material-bottom-tabs": "0.1.3",
"react-navigation-tabs": "^0.5.1"
}
Do I need to use npm to install all these libraries or will the app download them automatically?
Thanks!
Yes, you need to npm install in the terminal, from the project root directory, to download and install the dependencies, as #gaback suggested in a comment.
Alternatively, if you prefer using yarn, you can yarn install from the same directory to install the dependencies.

Undefined is not an object (evaluating ExponentConstants.linkinguri)

Can someone guide me on this issue which shows up once I try using expo in my react native project.
Dependencies:
"expo": "^21.0.2",
"react": "^16.0.0-alpha.12",
"react-native": "^0.48.4",
"react-native-animatable": "^1.2.4",
"react-native-snap-carousel": "^3.3.2",
"react-native-swiper": "^1.5.13",
"react-navigation": "^1.0.0-beta.13"
Error Message
If I use create-react-native-app to initiate my project, I don't see the issue that you mentioned. But if I use react-native init to create my project, I see the same issue. To fully take advantage of the integration of react native and expo client, do the following:
npm install -g create-react-native-app
create-react-native-app YourProjectName
cd YourProjectName
npm start
Hope that helps.

NPM, package.json - how to add dependency with "#" in name

I am trying to install new Angular 2 RC in my project. Module name in NPM was changed from angular2 to #angular/core. But when I add it to my package.json, it tries to install module angular/core instead and doesn't find it. When I type
npm install #angular/core
in console, then Angular 2 is properly installed. Do you know why package.json skipps "#" in module name and how to fix it?
//Edit: I found out that it's not just a name, but "#" indicates a scoped package. Anyway, this should work using package.json (as described in documentation), but for some reason doesn't.
I am using Visual Studio 2015 with latest updates and my project is an ASP.NET MVC 6 project (which comes equipped with npm support)
You should use the package.json from Angular2 Docs:
{
"dependencies": {
"#angular/common": "2.0.0-rc.0",
"#angular/compiler": "2.0.0-rc.0",
"#angular/core": "2.0.0-rc.0",
"#angular/http": "2.0.0-rc.0",
"#angular/platform-browser": "2.0.0-rc.0",
"#angular/platform-browser-dynamic": "2.0.0-rc.0",
"#angular/router-deprecated": "2.0.0-rc.0",
"#angular/upgrade": "2.0.0-rc.0",
"systemjs": "0.19.27",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.5",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^0.8.1"
}
}
Then make sure and run npm install in the root directory.
Thanks #Dov Benyomin Sohacheski, I wasn't aware of this file.
But unfortunately it didn't resolve my problem. The key was my usage of Visual Studio 2015 and possible outdated version of NPM that shipped with it. I installed Node.js and configured Visual Studio to use this version instead of built-in one and it started working.
Here is a tutorial of how to make VS use our own version of GIT instead of built-in one. Steps for NPM are basically the same. One important difference is you cannot just uncheck $(DevEnvDir)\Extensions\Microsoft\Web Tools\External, because there are also other tools, so you need to add location of NPM above it.
My final configuration:
Don't forget to restart VisualStudio after that.