How to check my create-nuxt-app version and upgrade it? - vue.js

Background:
Previously, running yarn create nuxt-app myApp installs Nuxt v2.4.0 but today for example I noticed you downgraded to Nuxt v2.0.0. I did not change the development environment so I can not understand this behavior.
I did some search and complained elsewhere when I landed on this:
So the OP was asked to upgrade his create-nuxt-app version.
Question:
But how to do that ? How to check which create-nuxt-app I do have ?
Bonus:
I read why does Create-Nuxt-App installs nuxt version 1.4.5? and the answer says you: "Make sure you don't have a version of create-nuxt-app installed locally or globally." But how do you even install create-nuxt-app locally and globally ?
Info:
When I run npm list -g | grep 'nuxt-app' I do not get anything.

You are fine. You don't need to do anything.
If you create a project with create-nuxt-app you get "nuxt": "^2.0.0" in your package.json which means that your project automatically uses the latest 2.x.x version of nuxt. Also if there'll be an update to nuxt your project with update itself.
And to answer your two questions:
If you have create-nuxt-app installed in your project you can check its version using npm list create-nuxt-app (make sure you are in the project's directory). If it's installed globally you can check the version using npm list create-nuxt-app -g.
You can install create-nuxt-app locally using npm install create-nuxt-app and globally with npm install -g create-nuxt-app.

I finally found an answer here and there:
This execution screenshot from #manniL on Github is helpful also:

To check the existing NuxtJS Version of the project,
run yarn why nuxt on your terminal from the project root directory.
If you want to check for the VueJS version, install Vue Developer tool web extension, and check for Vue version.
source

If you have installed create-nuxt-app globally using npm, first uninstall that. Using the below command.
npm uninstall -g create-nuxt-app
Then reinstall it. And the latest version of the package will be installed.
npm install -g create-nuxt-app

Related

How to update npm package's dependency?

I am trying to update dependency of package I am installing trough npm.
When I install appium package, I get version 1.22.0 which is correct. But this package also have dependencies that getting regular updates on github and are propagated on npmjs.
But when I install main package, dependency is not latest.
For example, I need to update appium-espresso-driver dependency of appium to 1.50.1, but everytime I install appium, dependency is only 1.45.3, even when appium have ^1.0.0 in package.json
How to update this? Do I need to wait for appium package to be bumped?
If you want to update all the packages to the latest version and you are using npm, you can see this documentation npm-update, but the short answer is:
npm update
This helps to update every package of the project, you can do it in the root folder, and update everything in the package.json.
If you want to update everything to a latest version, you can use npm-check-updates, this will check the latest version of the packages that you have installed on package.json, I will show you the easy steps to install this but you can go through the documentation of the module in here:
npm install -g npm-check-updates
This will install you the package, then after that you need to run in in the root folder:
ncu -u
So after that command it will update all the packages in the package.json but not install them, so after running ncu -u you need to run again:
npm install
To install the new versions of the package.

Globally installation of packages with npm

I have a question regarding the package manager npm and the meaning of installing the package globally.
For example I work often with react, should I install react globally?
npm install -g react react-dom
Does this mean that next time when I do
npx creat-react-app my-app
It will get the package from the global or it does not matter and it will still download it locally inside my-app?
Because I really do not understand the idea behind installing globally.
Because if I want to use a package it should be mentioned in package.json, if it is in package.json it is then located in node_module ... so yeah ...
Could anyone give me better insight?
Thanks in advance
React library can be installed globally on your local machine. In development there is no real reason to do that since you might not have the latest version and this might cause issues.
Better practise is to use react on project level by using the command you stated above npx create-react-app my-app
If you push code to a server the package.json file will install the dependencies (React, React DOM,..) to build your project.
Read more here : https://create-react-app.dev/docs/getting-started/
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 or yarn global remove
create-react-app to ensure that npx always uses the latest version.
You can check what packages are installed globally using:
npm list -g --depth 0

How to Update Angular Cli

Just to give you some context.
I was running a project and after ng serve I was getting this warning message:
our global Angular CLI version (9.1.4) is greater than your local
version (1.0.0). The local Angular CLI version is used.
I googled and figured out I should update angular cli with the following command.
npm install --save -dev #angular/cli#latest
After that I am getting the following error when trying to build the project:
The build command requires to be run in an Angular project, but a project definition could not be found
Any help will be much appreciated.
After reading some issues reported on the GitHub repository, I found the solution.
In order to update the angular-cli package installed globally in your system, you need to run:
npm uninstall -g angular-cli
npm install -g #angular/cli#latest
Depending on your system, you may need to prefix the above commands with sudo.
Also, most likely you want to also update your local project version, because inside your project directory it will be selected with higher priority than the global one:
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
npm install
After updating your CLI, you probably want to update your angular version too
Note: if you are updating to Angular CLI 6+ from an older version, you might need to read this
Edit: In addition, if you were still on a 1.x version of the cli, you need to convert your angular-cli.json to angular.json, which you can do with the following command:
ng update #angular/cli --from=1.7.4 --migrate-only
check here for more details.

How do I install webpack version 4.19.1?

My system already has webpack version 4.27.5, but I need to uninstall this version and then use an older version 4.19.1, instead. I'm using Ubuntu.
I've run the command:
npm uninstall <web package>
but my issue was not resolved.
I recommend you to create a .npmrc file and add it
save-exact=true
This will prevent you from get packages like "^4.19.1", which AFAIK this means, get any package above 4.19.1
and then just install the needed package using the following command
npm install webpack#4.19.1 --save-dev

Cannot upgrade aurelia-cli from 0.21.0 to 0.23.0

When I try to upgrade aurelia-cli from 0.21.0 to 0.23.0 on Mac OS X 10.11.6, au -v displays the version as 0.21.0 instead of 0.23.0. I even tried the following, to no avail.
npm uninstall aurelia-cli -g
npm cache clean
npm install aurelia-cli -g
au -v
0.21.0
npm outdated
Package Current Wanted Latest
aurelia-cli 0.21.0 0.23.0 0.23.0
There's a few things you'll need to do. First, and based on your comments, you may have already done this: you need to run npm install aurelia-cli --save-dev. This will update the local version of the Aurelia CLI. Each Aurelia project gets its own local version of the CLI so that upgrading your global version of the CLI won't magically break something in a project. This is especially important currently with the CLI in alpha and thus the possibility of breaking changes being somewhat likely.
If you have already done this and you're still seeing 0.21.0 when you run au -v, then run rm -rf node_modules in the project directory and then npm install. Sometimes npm can be a pain in the butt.
As you are moving from v0.21.0 of the CLI to v0.23.0, you will need to follow the instructions for updating your aurelia.json file found here. These instructions are unrelated to the problem you're having, but you need to be aware of them.
I hope this helps!