How can I install a specific NativeScript version? - npm

Im trying to install the tns 6.7.4 version, but I just get the 7.1.2 version.
I tried to do:
sudo npm uninstall -g nativescript
sudo npm cache clean --force
sudo npm install -g nativescript#6.7.4
I also tried with nativescript#6 and also with nativescript#6.7 but everything ends with the 7.1.2 version.

The command npm i -g nativescript will install the NativeScript CLI. It won't update/migrate your existing project. However, once you have installed a specific version of the CLI, you can use it to create new projects with the related versions.
For example
npm uninstall -g nativescript
npm i -g nativescript#5.4.0
tns --version // will output 5.4.0
Once you have the wanted version of the CLI you can create a project that uses the core dependencies

Related

Why am I unable to install expo cli?

I have followed the documentation from Expo website, installed NodeJs, git, watachmann, however I m still getting errors when installing Expo cli:
First, ensure you use the recommended version of nodejs. For that, you can use the n module:
// if you haven't installed it before
sudo npm install n -g
//to have the latest stable version
sudo n stable
Then delete all your preview installs with npm and start over. For expo-cli:
sudo npm uninstall --global expo-cli
sudo npm install --global expo-cli

create-react-app not working not after upgrading npm and nodejs

I upgraded npm and nodejs to 6.14.4 and 12.16.3 resp. Getting below error while creating react app using create-react-app.
According to readme:
If you've previously installed create-react-app globally via npm
install -g create-react-app, we recommend you uninstall the package
using npm uninstall -g create-react-app to ensure that npx always uses
the latest version.
So resolved the problem using command:
npx create-react-app contactmanager

Expo cli update not happening

I am trying to upgrade expo-cli from 2.11 to 2.18 but npm i -g expo-cli#latest still points to the old version.
when I typed expo-cli -V it resulted:
2.11 ...so naturally npm i -g expo-cli#latest will grab the latest version and install it but still expo-cli -v is still pointing to the old version.
I remember installing packages in bash level is a no go operation.
these are some images to put it all into context:
Update: Removed Nodes modules as suggested in the first answer, and that lead to npm removal both expo and expo-cli are not found with the command where
For mac users (linux should be very similar):
Find your expo-cli version:
which expo-cli
For me it yielded:
/Users/username/.config/yarn/global/node_modules/.bin/expo-cli
Remove this outdated version:
rm -rf /Users/username/.config/yarn/global/node_modules/.bin/expo-cli
Check that you are using the latest version:
expo-cli --version
Updating expo-cli globally can be a right pain. To those experiencing this frustration, use yarn
yarn global add expo-cli
it will give you far fewer headaches
On MacOS (Linux should be very similar):
Find the location of the expo-cli version:
which expo-cli
You would probably get:
/usr/local/bin/expo-cli
Remove this outdated version by using:
rm -rf /usr/local/bin/expo-cli
Then install the latest version:
npm install -g expo-cli
After that, check that you are using the latest version:
expo-cli --version
If you're like me, and none of this stuff worked, maybe my solution will help.
My problem is that I switched from NPM, to Yarn at some point, and I had global packages in both systems, which was giving me a bunch of trouble.
Step 1: Make sure you don't have expo-cli in global npm
npm list-g
Step 2: If it is in global npm, uninstall it
npm uninstall --global expo-cli
Step 3: Install it fresh with yarn
yarn global add expo-cli
Step 4: Stop using npm for global packages (or at least, only use one system)
edit: spelling
If you are using a Mac, these 2 commands will do the tricks
1)which expo to locate expo in your Mac which will give you this "/usr/local/bin/expo"
2) "cd /usr/local/bin/"
3)-rm expo
4)-rm expo-cli
the hole system was behaving oddly!, npm should've been installed with node but it was nowhere to be found.
I had to remove node and reinstall it again, then I had to install expo-cli again and all errors went away.
When npm does not work in an easy way, --force it!
npm install -g expo-cli --force
Update to the latest version of Expo CLI:
npm i -g expo-cli. expo-cli#4.7.2 or greater is required.
Update to the latest version of EAS CLI if you use it:
npm i -g eas-cli.
Run expo upgrade in your project directory.
Reference: https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/
there is more than a reason for not updating the expo-cli.
reason 1 - you maybe installed expo-cli using yarn and after a while you need to update and using npm npm install -g expo-cli it will update but maybe when you run expo its point to that yarn version so to resolve this you need to run yarn global remove expo-cli.
reason 2 - it might you have two versions of expo-cli one its global version and one inside your project folder/path, so even you upgrade expo-cli globally, your project still point to the first class version which is in your project folder. to resolve this you need to uninstall expo-cli which exists in your project folder to point to the global version and you can do this using this command npm uninstall expo-cli notice without -g.
reson 3 - sometimes you need to clean npm cache. if nothing works for you above try to uninstall expo-cli using npm uninstall -g expo-cli and then run this command npm cache clean --force then install expo-cli again npm install -g expo-cli.
expo-cli --version
npm uninstall expo-cli
npm install -g expo-cli
expo-cli --version
if cannot, you can update manually
check path
npm bin -g
change "node_modules" folder or remove
C:\Users{username}.npm-global\node_modules
npm install -g expo-cli
copy\past expo-cli folder
from C:\Users{username}.npm-global\node_modules\expo-cli
to C:\Users{username}\AppData\Roaming\npm\node_modules\expo-cli
expo-cli --version

Demo using Aurelia- can not install jspm

I following this link https://github.com/rmourato/Mvc5-Aurelia
I can not install jspm and run project
I already install nodejs
Can anyone help me on this.
Next to nodejs (which installs npm) you also need to install gulp and jspm.
So change into the Mvc5-Aurelia/Aurelia directory and run:
npm install
npm install -g gulp
npm install -g jspm
More details here: https://github.com/rmourato/Mvc5-Aurelia/tree/master/Mvc5-Aurelia/Aurelia under Running the App
After that you can run gulp watch

Unable to link react-native-version-number

I am trying to install react-native-version-number. The instructions state that after installing, issue;
react-native link react-native-version-number
but when I do this, I get the following error message;
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
but when I run
npm uninstall -g react-native
I get
npm WARN uninstall not installed in /usr/local/lib/node_modules: "react-native"
How do I link react-native-version-number?
As a workaround, dv3's comment about using rnpm link did work. However, I found that I was having this problem with other react-native commands, such as react-native run-android. This appears to be because npm was installed using homebrew. A description of this problem and how to fix it can be found at on this gist. In summary the required fix is to uninstall all your npm globably installed packages, uninstall node, then reinstall node, and reinstall npm without brew.
npm list -g --depth=0 # to list all your globally installed packages
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
and then, you have to reinstall all your npm packages that were installed globally.