Project in git for macOS and Windows


I have a workstation at home under macOS, and then a laptop under Windows.
I have started working with git to be more productive, but the problem has been when after creating a web project in the imac with npm using bootstrap, font-awesome as dependencies and gulp, gulp-sass, browser-sync, etc. as development dependencies, when doing a pull under Windows, I get dependency errors to the operating system.

I have tried the same thing, but vice versa, I created the project under win, but when I try to work under macOS, it pulls me out of system dependencies.

Is there any way to work with a repository regardless of the operating system?

This is the repository, where I am working.



Windows PowerShell   Copyright (C) Microsoft Corporation. All rights reserved.
  PS C: \ Users \ Portable-Luis \ Desktop \ git \ the-band > gulp serve   C: \ Users \ Portable-Luis \ Desktop \ git \ the-band \ node_modules \ node-sass \ lib \ binding.js: 15         throw new Error (errors.missingBinary ());         ^
  Error: Missing binding C: \ Users \ Laptop-Luis \ Desktop \ git \ the-band \ node_modules \ node-sass \ vendor \ win32-x64-57 \ binding.node   Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x
  Found bindings for the following environments:     - OS X 64-bit with Node.js 8.x
  This usually happens because your environment has changed since running 'npm install'.   Run 'npm rebuild node-sass --force' to build the binding for your current environment.       at module.exports (C: \ Users \ Laptop-Luis \ Desktop \ git \ the-band \ node_modules \ node-sass \ lib \ binding.js: 15: 13)       at Object. (C: \ Users \ Portable-Luis \ Desktop \ git \ the-band \ node_modules \ node-sass \ lib \ index.js: 14: 35)       at Module._compile (module.js: 643: 30)       at Object.Module._extensions..js (module.js: 654: 10)       at Module.load (module.js: 556: 32)       at tryModuleLoad (module.js: 499: 12)       at Function.Module._load (module.js: 491: 3)       at Module.require (module.js: 587: 17)       at require (internal / module.js: 11: 18)       at Object. (C: \ Users \ Laptop-Luis \ Desktop \ git \ the-band \ node_modules \ gulp-sass \ index.js: 187: 21)   PS C: \ Users \ Portable-Luis \ Desktop \ git \ the-band >

I just realized that by putting what they tell me: npm rebuild node-sass --force I create new files and I can run my "gulp serve" without problems. But it creates new files that are waiting to be uploaded in the next commit.

Forgive my ignorance about it, I'm a graphic designer, and this escapes me.

When I design an interface and send it anywhere, it looks and opens under the same software psd, ai, sketch, etc .. surely this is wrong, but I do not understand why I can not see the project and work with the in different operating systems, and more when I created a .json with dependencies of production and development.

asked by Luis Quesada Romero 18.03.2018 в 03:13

1 answer


Quick solution

Execute the npm rebuild node-sass --force command as described in the console error.

Effective solution

The problem is derived from not having a file .gitignore therefore the files in the folder node_modules are being loaded to your remote repository every time you push, this is not desired since packages sometimes depend on an operating system, the programs installed in your development environment, among other things.

First you have to create a file .gitignore in the root of your project, ideally include it as soon as you start the project (GitHub has a listing of files so you can use the one that best suits your project, I recommend you use the node one) and enter this line:


Then we will remove the node_modules folder by executing the following commands

git rm -r --cached node_modules
git commit -m "Remove node_modules"

Do not forget to add your new file

git add .gitignore
git commit -m "Add gitignore"

And finally we upload the changes to the repository

git push origin master
answered by 18.03.2018 в 04:45