DEV Community

Bret
Bret

Posted on

Venv for Vue?

Can I use Venv/Env for a vue project?
I’ve been using Django/python, and I want to contain things

Top comments (9)

Collapse
 
briancaffey profile image
Brian Caffey

For a Vue project, all of your project dependencies will be contained in node_modules. When you run npm install in a Vue project, this is similar to doing pip install -r requirements.txt in whatever virtual environment you are using with a Python project.

Collapse
 
yobretyo profile image
Bret

ok, my node-modules is greyed out on one of my computers. what causes that?

Collapse
 
briancaffey profile image
Brian Caffey

If node_modules is greyed out, that means that the files in that folder are not tracked by source control (git). The files in that folder are still there, and they are read by your application when it runs. If you have a pip environment with .env in your project directory, this file will also by greyed-out.

Thread Thread
 
yobretyo profile image
Bret

how do I un-grey it? does that effect anything?

Thread Thread
 
ericgeek profile image
EricGeek

That would mean that you're checking your dependencies into git. Unless you have a specific reason for doing that, it's generally advised not to do that. It makes your git repository larger, often much larger, depending on your dependencies.

Thread Thread
 
briancaffey profile image
Brian Caffey

Do you have a file in your project called .gitignore? If you look in this file, you should see a line referencing node_modules. You can comment out this line, and then add node modules to git by running git add node_modules. If you are pushing your code to GitHub, I recommend that you do not push anything from node_modules.

Thread Thread
 
yobretyo profile image
Bret

I’m not using GitHub, I just created a new react project and it was greyed out

Thread Thread
 
briancaffey profile image
Brian Caffey

OK, if you used create-vue-app or a similar tool for starting a Vue project I think it will add .gitignore automatically. What is your concern with the node_modules files? In general there should be no reason to go into that folder. If you want to see what is installed there you can look into package.json.

Thread Thread
 
raj_prabhakar profile image
Raj Prabhakar

I also have the same issue, the node modules folder is greyed out and because of that I couldn't able to use any packages in my code, for example I imported react-native-vector-icons/Ionicons inside my project and when I use the Icon component to display the icon, The icon is not showing in my project. And also I couldn't use any packages in my project. So, Is there any solution for this issue?

I created new project and not by cloning from github