I am using Vue3 for studying but it cannot support Vuetify library. So I need to downgrade it to version 2. How can I do that?
Vue3 is not installed in global. And vue-cli is installed in global, which is version 4.5.15.
You can use
npm install <package>#<version>
However, if you have components you have to update their code also.
1 INSTALL VUE JS 2
npm install vue#2.x.x
2 UPDATE YOUR VUE-LOADER
npm update vue-loader
3 if it is not installed, install it
npm i vue-loader
4 install vue/compiler-sfc
npm add vue#next
npm add #vue/compiler-sfc -D
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
I am using ubuntu 18. I tried to install the vuejs. I have already installed node version 8.10 and npm version 3.5.2. while i tried to install i receiving error like this. I have attached the screen shot.
Kindly refer below screen shot also
It looks like you are trying to install Vue in the global node_modules directory.
A tried and true way is running the same command from within your node.js project.
cd /home/hp/coolproject
npm install vue
Another great way to use Vue is Vue CLI
You need to install #vue/cli and possible options for you will be to either use yarn or npm but not apt. You will have to install the vue package globally so for that in npm use -g or global in yarn. The full commands will look like this:
sudo npm install -g #vue/cli or sudo yarn global add #vue/cli.
To make sure you have vue installed then run vue --version for short.
Let me know is that fixes your problem.
When creating a new Vue (2.x) project using Vue CLI v4 with the command:
vue create example
...I should be prompted for selecting which features I'd like to enable. For some reason, the CLI jumps straight to creating the project, presumably with features I've selected before.
How can I get the cli to let me specify features again?
It seems your Vue CLI installation is somehow toasted.
As the first fix attempt I'd try deleting the file .vuerc file in your user home directory (~/.vuerc) where Vue CLI stores the saved presets.
If that doesn't help, I'd recommend reinstalling the Vue CLI package globally:
Steps to reinstall Vue CLI globally
# If Vue CLI is installed globally, remove the installation
# Check globally installed packages list with NPM
npm list -g --depth 0
# OR with Yarn
yarn global ls
# Depending on which package manager it has been installed with
# Uninstall with NPM
npm uninstall -g #vue/cli
# OR with Yarn
yarn global remove #vue/cli
# Install currently newest Vue CLI version with NPM
npm install -g #vue/cli
# OR with Yarn
yarn global add #vue/cli
It seems that your project set prompt=false and use JSON to create projects. As far as I know, you should set prompt=true or for each project use should use:
vue create example --default
This should prompt features (>manually select features).
In Vue's Documentation, you can find the create project options creating projects with Vue
In Reactgo page, they showed some features of project creation process How to create Vue project
The issue for me was that I was using Git Bash to vue create app-name instead of Windows CMD.
Once I re-ran the command in Windows CMD the Vue feature selection worked properly.
I'm trying to install Vue-cli environemnt via NPM.
npm install --global vue-cli
After that I want to create project
vue init webpack my-project
And I get an error
'vue' is not recognized as an internal or external command,
operable program or batch file.
I've read some solutions, most of them concern changing
PATH to C:\Users{YourUser}\AppData\Roaming\npm
Didn't work for me. Can anyone help.
I follow these commands, It's work fine for me.
npm install -g vue-cli
npm install -g vue
Edit the System environment variables, and enter the following path, and if still having a problem just try to add a path in System User Variables
C:\Program Files\nodejs\node.exe;
C:\Users\{UserName}\AppData\Roaming\npm
Check vue installed in C:\Users{UserName}\AppData\Roaming\npm
yarn add #vue/cli-service
or
npm install #vue/cli-service
is what worked for me
Well, problem was solved by simply deleting everything related to vue-cli installed before. And re-installing vue-cli.
I have faced simillar issue and re-installing vue-cli didn't work for me. Strange thing is vue and vue-cli get installed successfully but once I tried to create project by using below command
vue init webpack myfirstproject
I get below error:
'vue' is not recognized as an internal or external command,operable program or batch file.
Tried various solutions but nothing worked for me. Please find my NPM and Node details below:
NPM version: 6.2.0
Node version: 8.7.0
Actually the issue was "vue-cli" is not supporting to my Node(8.7.0). It requires Node >=8.9. Once I upgraded my Node version. everything is working fine.
upgrading your Node version is the correct way to deal with this issue
I found this same issue with another possible problem. I had
create-react-app#1.5.2 installed globally
npm list -g --depth=0 will display your globals
I simply uninstalled create-react-app
npm uninstall create-react-app
Vue vue-cli-service now works as expected.
had the same issue, i deleted my node_modules and re-install and it worked
I had the same problem after searching a lot I found this solution:
You need to Add C:\Program Files\nodejs to your PATH environment variable. To do this follow these steps:
Use the global Search to go to "Environment Variables"
Click "Edit system environment variables"
Click "Environment Variables" in the dialog
In the "System Variables" box, search for Path and edit it to include C:\Program Files\nodejs.
You will have to restart any currently-opened command prompts before it will take effect.
I hope it works, good luck!
I was installing #vue/cli using yarn, i.e. I ran
yarn global add #vue/cli
Calling vue on windows did not work after the installation ('vue' is not recognized as an internal or external command)
What I needed to do was to add C:\Users\<MY USERNAME>\AppData\Local\Yarn\bin to path.
yarn global add #vue/cli did not work for me
So I removed using yarn global remove #vue/cli
Then I installed using npm install -g #vue/cli and its working fine.
1)Try to remove all the node files, npm and nvm files/folders.
2)Also, remove the PATH of node js and nvm from environment variables.
3)try commands:
node -v
npm -v
nvm -v
above commands only to make sure that all the entities related to node are uninstalled.
4) install node, and if necessary install nvm(optioal), then run command
npm install -g #vue/cli
above procedure proven to be useful for me. Just give it a try!
for Yarn -> need to install it:
npm install -g yarn
Installing Vue CLI Package:
yarn global add #vue/cli
To create project:
vue create project-name
To run:
yarn serve
Uninstalling:
yarn global remove #vue/cli
I follow "npm" package manager instead of "yarn" package manager console because yarn give me a problem while installing it;
command to install Vue CLI:
npm install -g #vue/cli
For to create Vue project:
vue create "project-name"
For to run Vue project:
npm run serve