Ionic App v1 - updating Ionic Framework Version (not Ionic CLI) - android

I'm trying to understand how to update my Ionic Framework Version.
ionic info
Your system information:
Cordova CLI: 8.0.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.1.0
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS:
Node Version: v6.9.1
So the current Ionic Framework Version is "1.1.0"
I updated my bower.json:
{
"name": "hello-ionic",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.3.3"
}
}
and run bower install
but the new files are being stored at 'bower_components' folder
My folder structure:
I also copied the files from 'bower_components' to 'lib' folder and still after ionic info the 'Ionic Framework Version' is still '1.1.0'

Try with
npm install -g ionic#1.3.3
After the CLI has been updated you have a few options when it comes to updating your base library install, goto the root of your project and run this command:
ionic lib update
Here for more details. hope it helps.

Try to upgrade the project to the new versions:
npm install -g ionic#latest
npm install ionic-angular#3.7.0 --save
npm install #ionic/app-scripts#3.0.0 --save-dev
npm install #angular/core#4.4.3 --save
npm install #angular/common#4.4.3 --save
npm install #angular/compiler#4.4.3 --save
npm install #angular/compiler-cli#4.4.3 --save
npm install #angular/forms#4.4.3 --save
npm install #angular/http#4.4.3 --save
npm install #angular/platform-browser#4.4.3 --save
npm install #angular/platform-browser-dynamic#4.4.3 --save
npm install rxjs#5.4.3 --save
npm install zone.js#0.8.17 --save
In addition to improving ionic-angular 3.x.
Also, if you're using animations, run the command:
npm install #angular/animations#4.4.3 --save
It looks like you might actually want
npm update packagename
which does try to honor semver, and does recursively update all the dependencies of packagename. Of course, it does them all recursively asynchronously at once.
If you can give up the need for updating deps-of-deps, then you can get pretty far with
npm --depth 0 update grunt
After a research:
npm will correctly handle version conflicts between shared
dependencies by downloading the correct one for each. So, if Dep A
depends on Dep C v1.0.0 and Dep B depends on Dep C v2.0.0, they will
each be installed and used appropriately. Therefore, you are free to
install the latest of any packages you would like.
Then, feel free to update update package by package or use (AFTER UPDATE YOUR ANGULAR PACKAGES) and exclude for a while the ionic packages from the packages.json to don't update them:
npm i -g npm-check-updates
ncu -u
npm install

The ultimate version of IONIC v1 is 1.3.5, I guess.
You'd better make a global install of ionic, first.
sudo npm i -g ionic
Then, install new Ionic v1 CLI Utility locally for CLI commands as it has been released for v1 project maintenance.
npm i #ionic/v1-toolkit

try command: npm install -g cordova ionic.

simple run
ionic lib update
See official Docs

While the other answers are correct only on updating ionic version with experience I can say you might have old dependencies which might crash with your upgrade so best is to use, https://www.npmjs.com/package/npm-check-updates after installing the package run npx npm-check-updates this will recommend and update all your packages to latest stable.

Related

the development server returned response error code 500 - react native - ./configs/main

I got this error when i tried to make hello-world sample:
react-native init hello_world
cd hello_world
react-native run-android
Even when I ran:
npm install -g react-native-git-upgrade
react-native-git-upgrade
I got same error on commend line console.
I've searched and tried many solutions but it doesn't seem to work:
Example:
* upgrade react-native
* using watchman watchman watch-del-all
* remove node_modules
* clean cache npm cache cleanor npm start -- --reset-cache
Operation: Window 8
react-native-cli: 2.0.1
react-native: 0.44.2 ( tried 0.47.1 too )
Android: Simulator Nexus5X
Thank you all in advance!
Delete babel-preset-react-native folder inside node_modules and then install older version 2.1.0 of this library with npm install babel-preset-react-native#2.1.0 --save-dev.
In case if someone is using react-native: 0.57.1 or the latest one,babel-preset-react-native has been replaced by metro-react-native-babel-preset. if you still get 500 error while connecting to the device do the below step and I guess things will be fine
npm add #babel/runtime
npm install
Downgrade the following:
react-native init Project
cd Project
npm uninstall react-native
npm install --save react-native#0.55.4
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native#4.0.0
react-native run-android
For me it's about the react native version. I just install the new version of react native "0.59.2" then i downgrade to previous version to "0.55.2", and everything works fine.

Ionic 3 Android build error

I am using Ionic 3. Right now I'm trying to do ionic cordova build android , but I get TypeError: env.runcmd is not a function (please see the photo attached).
I tried to:
-> ionic cordova platform rm android then ionic cordova platform add android then again build android again
-> delete node_modules folder and do npm install then build android again
But none of them helped it...
My ionic info output:
Just use command 'cordova run android' instead of 'ionic cordova run android'.
Okay, guys, the problem was exactly with cordova version. I haven't noticed when it did update to the version 7.0.1. However, I had to downgrade it to version 6.5.0 and then android build succeeded.
The only thing that confused me was the downgrade process. Every time I did sudo npm uninstall cordova -g, the cordova command was still available at bash. If I would do sudo npm install cordova#6.5.0 -g, the version still remained 7.0.1. Even some other commands such as ... --save --save-exact ... did NOT work.
So below are the steps which I've gone through to solve this issue (I am using Ubuntu linux, so this will work for linux users only).
First I uninstalled cordova through npm
sudo npm uninstall cordova -g
Then removed the program from local bin
sudo rm /usr/local/bin/cordova
Installed the specific version of cordova
sudo npm install cordova#6.5.0 -g (or whatever version you want)
And lastly, I have to admit that after cordova installation, it was now located at /usr/bin/cordova, no more at /usr/local/bin/cordova, so I had to create a hard link to it.
sudo ln -s /usr/local/bin/cordova /usr/bin/cordova
VoilĂ !

Transpile errors with cordova-plugin-file-transfer

I want to use the cordova file transfer plugin. I'm using it through the Ionic-Native transfer module.
The app won't run because there is a transpile error with the file transfer plugin and the file plugin:
transpile started ...
typescript: plugins/cordova-plugin-file-transfer/types/index.d.ts, line: 9
Cannot find type definition file for 'cordova-plugin-file'.
L8: * #param server URL of the server to receive the file, as encoded by encodeURI().
L9: * #param successCallback A callback that is passed a FileUploadResult object.
L10: * #param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
I installed #types/cordova-plugin-file through npm, but the app won't run because of duplicate identifiers in the two cordova-plugin-file packages:
transpile started ...
typescript: node_modules/#types/cordova-plugin-file/index.d.ts, line: 376
Duplicate identifier 'PERSISTENT'.
typescript: node_modules/#types/cordova-plugin-file/index.d.ts, line: 377
Duplicate identifier 'TEMPORARY'.
typescript: plugins/cordova-plugin-file/types/index.d.ts, line: 376
Duplicate identifier 'PERSISTENT'.
typescript: plugins/cordova-plugin-file/types/index.d.ts, line: 377
Duplicate identifier 'TEMPORARY'.
What is the right approach here?
As mentioned, it looks like the typings in cordova-plugin-file-transfer are incorrect.
It should be an external module but it is currently a script file (copied from DefinitelyTyped directly).
On the other hand, since cordova-plugin-file already includes its own typings, you don't need to install #types/cordova-plugin-file.
I experienced this issue as well.
However I was able to work around the issue with the following operations:
Setup :
```
Your system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.1
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.7.4
Xcode version: Xcode 8.2.1 Build version 8C1002
```
Initial Problem :
```
$ ionic build ios
Running 'build:before' npm script before build
> apoc# build /Users/js/dev/apoc-ochem/app_v3/apoc
> ionic-app-scripts build
[01:47:59] ionic-app-scripts 1.2.1
[01:47:59] build dev started ...
[01:47:59] clean started ...
[01:47:59] clean finished in 2 ms
[01:47:59] copy started ...
[01:47:59] transpile started ...
[01:48:04] typescript: plugins/cordova-plugin-file-transfer/types/index.d.ts, line: 9
Cannot find type definition file for 'cordova-plugin-file'.
L8: * #param server URL of the server to receive the file, as encoded by encodeURI().
L9: * #param successCallback A callback that is passed a FileUploadResult object.
L10: * #param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
[01:48:04] ionic-app-script task: "build"
[01:48:04] Error: Failed to transpile program
Error: Failed to transpile program
at new BuildError (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/util/errors.js:16:28)
at /Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/transpile.js:102:20
at transpileWorker (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/transpile.js:68:12)
at Object.transpile (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/transpile.js:26:12)
at buildProject (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/build.js:98:78)
at /Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/build.js:46:16
npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/js/.nvm/versions/node/v7.7.4/bin/node" "/Users/js/.nvm/versions/node/v7.7.4/bin/npm" "run" "build"
npm ERR! node v7.7.4
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! apoc# build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the apoc# build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the apoc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs apoc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls apoc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!
/Users/js/dev/apoc-ochem/app_v3/apoc/npm-debug.log
```
Steps for Work Around:
Remove Platform
Remove Cordova plugin
Rebuild project
Add Platform
Remove cordova-plugin-file-transfer plugin
Rebuild ios project
```
$ cordova plugin rm cordova-plugin-file-transfer
Removing "cordova-plugin-file-transfer"
$ ionic build ios
...
...
[02:01:20] lint finished in 3.70 s
Error: No platforms added to this project. Please use `cordova platform add <platform>`.
$ ionic platforms add ios
Adding ios project...
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: com.nielssievertsen.apocsocial
Name: apoc social
iOS project created with cordova-ios#4.3.1
Installing "com.synconset.imagepicker" for ios
Installing "cordova-plugin-camera" for ios
Fetching plugin "cordova-plugin-compat" via npm
Installing "cordova-plugin-compat" for ios
Installing "cordova-plugin-console" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-device-motion" for ios
Installing "cordova-plugin-facebook4" for ios
Installing "cordova-plugin-googleplus" for ios
Google Sign-In prerequisites
START Running hook to add iOS Keychain Sharing entitlements (required since iOS 10)
Will add iOS Keychain Sharing entitlements to project 'apoc social'
END Running hook to add iOS Keychain Sharing entitlements (required since iOS 10)
Installing "cordova-plugin-media-capture" for ios
Fetching plugin "cordova-plugin-file" via npm
Installing "cordova-plugin-file" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.
Dependent plugin "cordova-plugin-compat" already installed on ios.
Installing "cordova-plugin-nativestorage" for ios
Installing "cordova-plugin-shake" for ios
Dependent plugin "cordova-plugin-device-motion" already installed on ios.
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-statusbar" for ios
Installing "cordova-plugin-whitelist" for ios
Installing "cordova-sqlite-storage" for ios
installing external dependencies via npm
npm install of external dependencies ok
Installing "ionic-plugin-keyboard" for ios
Installing "phonegap-plugin-push" for ios
Discovered plugin "cordova-plugin-file-transfer" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-file-transfer#~1.6.1" via npm
Installing "cordova-plugin-file-transfer" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
$ cordova plugin rm cordova-plugin-file-transfer
Uninstalling cordova-plugin-file-transfer from ios
Removing "cordova-plugin-file-transfer"
"cordova-plugin-file" is required by (cordova-plugin-media-capture) and cannot be removed (hint: use -f or --force)
"cordova-plugin-compat" is required by (cordova-plugin-camera, cordova-plugin-media-capture) and cannot be removed (hint: use -f or --force)
$ ionic build ios
............
...
** BUILD SUCCEEDED **
```
Looks like the typings in cordova-plugin-file-transfer is incorrect.
It should be an external module but it is currently a script file (copied from DefinitelyTyped directly).
You should file an issue there.
On the other hand, since cordova-plugin-file already includes its own typings, you don't need to install #types/cordova-plugin-file.
It seems the "plugin/" folder is cordova plugins for ionic2, which you may not need to perform typescript compilation,
You can always ignore the index.d.ts by specifying the exclude target from tsconfig.json
For Ionic there is file called tsconfig.build.json
in it compiler option add below parameter.
"skipLibCheck": true
it should look like this
{
"extends": "...anytest....",
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"skipLibCheck": true
},
"exclude": [
"...your config here..."
]
}

installing ionic npm ERR! tar.unpack error

while installing ionic npm install -g ionic getting error.
Have tried : -
npm cache clean 2. run the cli by administrator 3. restarted the system but error remain same.
Badly stocked.
I was having same problem on Windows 8 (64 bit)
Solution:
Don't forget to install other dependencies before installing ionic http://ionicframework.com/docs/guide/installation.html
1) Uninstall Node from Control Panel
2) Restart PC
3) Download (MSI Installer) older version of Node from http://nodejs.org/dist/v0.10.38/ or 64bit http://nodejs.org/dist/v0.10.38/x64/
4) Install Node version 0.10.38
5) npm install -g cordova
6) npm install -g ionic
Done!
it is not nessesary to uninstall node...
just remove the old npm ionic folder
...AppData\Roaming\npm\node_modules\ionic
and try again
npm install -g ionic
For me the answers provided did not work. I got around this problem by installing cordova and ionic at the same time.
npm install -g cordova ionic
If proxy is preventing this, other things to try are setting the proxy, making http request and disabling strict-ssl. An example of setting proxy is
npm config set proxy=http://username:password#domain:port/
To make http request only change the config
npm config set registry=http://registry.npmjs.org/
To disable strict-ssl
npm config set strict-ssl=false
Also, if you wanted to view the default list of configs type
npm config ls -l
This will also show what configurations have been overridden.
Uninstall Node.js and install freshly after done installation run the following command
npm install -g ionic cordova
That's it.

How to update phonegap to 3.4.0

I'm trying to update my version of phonegap:
C:\Users\jhutber>phonegap -v
3.3.0-0.19.6
npm update -g phonegap
//runs....
//even updating npm
npm update npm -g
C:\Users\jhutber>npm info phonegap version
3.3.0-0.19.6
So how can I update my machine to use phonegap 3.4.0?
I'm using Windows 7.
$ sudo npm update -g cordova
its the command for update your Phonegap App...
in case you need more information visit:
http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface
Was looking at doing similar, hit the same issues. In the end I removed phone gap using a variety of
npm uninstall -g phonegap
npm uninstall phonegap
npm un phonegap
npm rm phonegap
npm -g rm phonegap
one of them worked, all of them complained.
Then check phonegap was gone, and
npm install -g phonegap
Seemed to work now at version 3.4.0-0.19.7
As an aside, I also drew a pentagram around my desk using the blood of a recently slaughtered goat, and I'm seriously starting to think that was the clincher..
Cheers
Ant

Categories

Resources