1

I've recently upgraded my netcoreapp1.0 to netcoreapp1.1. This left me wit ha few surprises and error that needed to be fixed. On top of that, I recently got a new PC, which forced me to go through even more things.

First up I had to install NodeJS again, and from the node package manager, install bower. After installing both NodeJS and bower, and several hours after working on my project, I realized, as I had to commit the changes to remote source control, that a node_modules folder had appeared (though hidden) in my project. Git of course wants to commit this folder, but I'd rather not since it contains loads of subfolders and other items.

Hidden node_modules folder

Git changes for commit

I was wondering what to do with this folder. I believe it shouldn't be there? And I'm not sure why it is. Shouldn't it be global or something, specific from PC to PC? Or should I just add it to my .gitignore file?

Quick info: It wasn't there prior to the upgraded project, meaning that I couldn't see any node_modules folder in netcoreapp1.0 and there's no folder in my source control?

4
  • The node modules folder should have been there before if you have used it you can simply ignore it by adding node_modules to gitignore file like you say. Maybe the folder was in wwwroot before? Commented Mar 15, 2017 at 16:40
  • I see you installed Bower locally that's why the node_modules folder appeared. You can also install it globally. Commented Mar 15, 2017 at 16:41
  • @JoelHarkes so it's simply because it's installed locally and not globally? Commented Mar 15, 2017 at 16:42
  • @JoelHarkes If you would create an answer, I'd gladly accept it Commented Mar 15, 2017 at 18:57

1 Answer 1

1

This node_modules folder wasn't there before because before it was installed globally:

npm install -g bower

the advantages of globally installing bower is that you can use the bower command through the command-line directly.

now apparently bower was installed locally, with the following command:

npm install bower

Now it was locally installed in the node_modules folder, meaning this folder appeared.

You don't need to check this folder into get and you can simple add the following rule in your .gitignore file:

node_modules

But 1 thing to remember! when you build your application with teamcity or some other CI build tool you will now need to install npm packages (just run npm install in the folder) before you publish your application, otherwise these javascript files will be missing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.