How to update nativescript cli - nativescript

Nativescript 5 is out and I am trying to update the tns version. Currently it tns --version shows as 4.3.2.
I followed all the steps in https://docs.nativescript.org/releases/upgrade-instructions but it still gives me the version as 4.3.2.
How can I upgrade nativescript-cli so that tns --version shows me the latest version.

I did following to reflect the update Nativescript cli. You should only follow this when npm install -g nativescript#latest doesn't reflect update the cli. You can check that using tns --version before and after.
Uninstall current nativescript cli using npm uninstall -g nativescript
Delete the existing tns command manuall if it still exist on your machine.
Install the latest Nativescript cli using npm install -g nativescript#latest
tns --version should now show the latest version.

How I did update tns:
run cmd as administrator (you using windows as i read above in one of comments)
(optional) run npm view nativescript version to check latest aveilable on npm
run tns install -g nativescript
restart cmd
run tns --version - hopefully you will see 5.0.0
hope this helps.
Btw, you might need to run some additional commands for your projects if you already added platforms
tns platform remove {platform}
tns platform add {platform}, where {platform} is android or ios
...also, you might run tns doctor after upgrading as I noticed it broke my other components like choco.

Related

We no longer support global installation of Create React App

can anyone explain what is this as far as I know I had installed sanity and nodemon globally they are also not allowed ?
PS C:\Users\Rupesh Gupta\Documents\GitHub\PinShare\pinshare_frontend> npx create-react-app#next --scripts-version=#next --template=cra-template#next ./
You are running create-react-app 5.0.0-next.60+6a3315b7, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
npm uninstall -g create-react-app
yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
PS C:\Users\Rupesh Gupta\Documents\GitHub\PinShare\pinshare_frontend>
I had the same issue on that project. I solved it by running
npx clear-npx-cache
and then
npx create-react-app#latest ./ --use-npm
"./" if you're already in the folder you wanted to CRA into, or "your-project-name" if you're not.

Running RNTester

I am getting into React Native. I want to try running RNTester to check out the components they have. I had no issue runnning my other react project.
I tried the commands:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
and also run the project with open RNTester/RNTester.xcodeproj
The errors I got:
error message
my Xcode version: 9.0(9C40b)
clang version: Apple LLVM version 9.0.0 (clang-900.0.39.2)
Instead of running with RNTester.xcodeproj
I got around with CocoaPods.
run pod install in the RNTester folder
run the .xcworkspace file generated from the command

Command npm.cmd install tns-template-hello-world-ng#3.4.3 --silent --save-exact --save failed with exit code 4294963238

I am having issue creating a new NativeScript app. I have uninstalled Node, NativeScript and reinstalled with no luck. I am having the same issue with NativeScript Sidekick. I am not sure what cause it happen but the last thing I did on my environment was upgraded node to v8. Below are versions of tools running on my computer:
Windows 10
Node v8.10.0
npm 5.6.0
Typescript 2.7.1
Thanks for the help.
I am not sure if it has to do with version compatibility; however, after upgrading npm (npm i -g npm) to version 5.7.1, I was able to create new NativeScript app. Seems to be too easy ...

NativeScript Sidekick won't run since CLI 3.2.1 update doesn't work

I opened NativeScript Sidekick on my Mac and it updated to the latest version 0.2.5.
It shows a dialog stating I need to update NativeScript CLI to 3.2.1 and the only option is to quit.
I went to Terminal and tried tns update but it won't update to 3.2.1 saying the platforms for 3.2.1 are not available. (I posted to the NativeScript forums and was told that is correct -- the platforms are at 3.2.0 while only the CLI is updated to 3.2.1.)
I also tried tns update 3.2.1 which simply says 3.2.1 platforms are not available.
tns doctor says 3.2.1 update is available.
NativeScript CLI version is 3.2.0
npm version is 5.4.1
node version is 6.11.3
I've tried creating a new project and it gives me the same issues.
How can I update to NativeScript CLI 3.2.1 so that I can run NativeScript Sidekick?
Solved over on https://discourse.nativescript.org/t/tns-update-3-2-1-not-working/2766/5
the command tns update will update your project, not CLI. If you want to update CLI do:
npm uninstall -g nativescript
npm clear cache
npm install -g nativescript
The command ths update is currently not working, we’ll investigate.
If you are using nvm to manage your NodeJS versions you can try to set the default version to the one that has installed NativeScript CLI. For example if you have NativeScript CLI on NodeJS version 8.9.2, execute:
nvm alias default 8.9.2
To check the packages installed on your active NodeJS version, execute:
npm list -g --depth 0

Phonegap installation error (npm)

I have been searching for a solution for two days now to setup Phonegap on my Windows 8.1
system without any success.
Whenever I try to install Phonegap through npm I get an error that I think has to do
with Cordova(-lib).
To install Phonegap I had to install Node.js (v0.10.28) on my system. After this I opened up Windows Powershell and issued the following command like instructed on the Phonegap website:
npm install -g phonegap
Output: (This is the only part of the error)
error notarget No compatible version found: cordova-lib#'lorinbeer/cordova-lib.git#configparser_module'
error notarget Valid install targets:
error notarget ["0.21.2","0.21.3"]
error notarget
error notarget This is most likely not a problem with npm itself.
error notarget In most cases you or one of your dependencies are requesting
error notarget a package version that doesn't exist.
I also tried installing just Cordova through the npm and then install Phonegap, but that
didn't solve anything either.
Running the Powershell with administrator rights also didn't help and tried solutions of other people who also had problems setting up Phonegap, but nothing works.
I really hope that someone could help me out here.
Thanks in advance.
Download the older version. I think there was a problem in the new one
npm install -g phonegap#3.4
I tried this and worked for me.
I had the same issue yesterday. If you check npm-debug.log, you'll notice that there is a permission issue ("Permission denied") when npm tries to access the cordova-lib git repository url. Actually, cordova-lib is a dependency for phonegap. So, it can't install it and I think that's why you get that error.
So, I tried this: install cordova-lib first then Phonegap. Yet, it still won't work; npm does not seem to check if cordova-lib is installed before trying to do it.
At this point, what I could do is to change the repository from which it retrieves cordova-lib. Here is the NPM install syntax:
npm install <tarball file>
npm install <tarball url>
npm install <folder>
npm install <pkg>
npm install <pkg>#<tag>
npm install <pkg>#<version>
npm install <pkg>#<version range>
This means I can install from a tar.gz file. Great! So, I just went to this page https://www.npmjs.org/package/phonegap to check the phonegap repository and performed these steps:
Download the zip of phonegap-cli repo (https://github.com/phonegap/phonegap-cli/archive/master.zip)
Unzip it
Open the package.json file and find the cordova-lib entry in dependencies (line 32)
Change the value to 0.21.3 which is the last version.
Recreate an archive of the folder to the tar.gz format
Open your CLI and run this command:
npm install -g path/to/archive/phonegap-cli-master.tar.gz
It should work now.
Hope that help!
I had a similar problem today too on Mac, even after Lorenzo said it should be all fine. Just running this:
sudo npm install -g phonegap
... produced loads of errors like this:
error: file ./objects/pack/pack-48c0ff4147fb7e8922546c4a857b98a1cb48e01f.pack is far too short to be a packfile
I combined Lorenzo and arpan shah's solutions:
sudo npm install -g phonegap#3.4
sudo npm cache clean
sudo npm update -g phone gap
... and it seemed to magically work.
Problem
We published with a dependency on a branch of cordova-lib. This fork appears unavailable when lots of requests are coming through (I think). One way or another, it's unreliable.
Changing the dependency to 0.21.3 will cause commands to fail, but will allow the install.
Solutions
update the 'cordova-lib' dependency to the npm published version '0.21.3'
**note, this will allow the install, but other phonegap commands will fail
wait for about 20 minutes, then npm update -g phonegap
testing an update to resolve this issue
further updates momentarily
update
We've pushed version 3.5.0-0.20.3 which should resolve this issue
$ npm update -g phonegap
if that doesn't work, try
$ npm cache clean
and reinstall phonegap
I tryed above comamnds npm cache clear and reinstall phoegap. It downloaded all libs but not command line scripts (phonegap command had still 3.4 as version). I found that better was to give command: npm install -g cordova (v 3.5)!

Resources