Is it possible to use brunch without Git? - brunch

We're trying to run the command
brunch new MySkeleton MyProject
this results in the error
02 Jul 14:56:30 - error: Error: npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
We don't use git, and would prefer to avoid switching source control systems right now. Is it possible to use brunch without git?
MySkeleton is stored in a subdirectory of the current directory. Likewise, the idea is to create MyProject in a subdirectory. The same error occurs with full paths, e.g. /JSapps/MySkeleton

The skeleton we're using contains references to other brunch pieces which live in github. So it seems that while brunch itself doesn't intrinsically require git, the fact that the brunch ecosystem is hosted in github makes the installation of a git a de-facto requirement.
But, just because brunch uses git, that doesn't mean we're forced to use it for source control. (Though it does mean we end up with a bunch of .git* files in our source control, which does seems rather "untidy")

brunch new MyProject MySkeleton

Related

npm start error caused by webpack version

I am having a problem when executing the command npm start on recently react apps. I don't have much experience with node.js and didn't find the exact problem on the internet so decided to ask here.
Two days ago I started having a problem that npm start didn't work in any react app I created, this morning I even created a new one with npx create-react-app test, opened the project folder in VSCode and immediately executed npm start but got the same problem so I don't think it is something I messed up in the other apps.
The error I get is this
> sci-cal#0.1.0 start C:\Users\virgi\OneDrive\Documentos\VS_VSC\typescript_vsc\test
> react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.44.2"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:
C:\Users\virgi\node_modules\webpack (version: 5.52.1)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if C:\Users\virgi\node_modules\webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sci-cal#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sci-cal#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\virgi\AppData\Roaming\npm-cache\_logs\2021-09-16T11_48_33_404Z-debug.log
I already tried the first four steps but it didn't fix the issue and webpack is in the node_modules project folder.
I think that it may be an issue of the react version I am using not being updated and thus not recognizing webpack version 5.52.1 but as previously said, I don't have much experience with react and didn't find the exact same problem fix on the internet so I decided to ask here before doing anything else to prevent the problem from possibly getting worse.
Since you already tried the first 4 steps, you can try to browse to C:\Users\virgi and check if you have the node_modules folder here. Delete it and run npm start in your project again

Fetching npm module from GitHub brings ".git" folder

I recently forked an npm package and updated it for my needs. Then, I changed the dependency on packages.json to point to my GitHub repo, and it worked fine. But, when npm installed the module, it brought also the git folder (.git). Because of that, when I try to install anything else, npm gives me this error:
npm ERR! path /node_modules/react-native-static-server
npm ERR! code EISGIT
npm ERR! git /node_modules/react-native-static-server: Appears to be a git repo or submodule.
npm ERR! git /node_modules/react-native-static-server
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
What am I doing wrong? How do I avoid the .git folder from being downloaded?
You can check the repo here: https://github.com/dccarmo/react-native-static-server
EDIT
The dependency in my packages.json:
"react-native-static-server": "dccarmo/react-native-static-server"
This seems to be an old question, but I was running into the same thing today.
I am rather new to git and npm, but I did find something that may be of help to someone.
If the git repo does not have a .gitignore, the .git folder is not downloaded / created.
If the git repo does have a .gitignore, the .git folder is downloaded / created.
I had two repos, one without a .gitignore (because when I made it I was not aware of what .gitignore was or did), and one with a .gitignore. I included both as npm packages in a project, and noticed that the one without the .gitignore was not giving me the EISGIT error (because of the .git folder).
So, after I found this question, I removed the .gitignore from that repo and now it too does not create a .git folder.
Later on, I discovered that adding both a .gitignore and a .npmignore to the project now stops the .git folder from appearing. I did not add .git in my .npmignore.

How to use locally built NPM package in project

I'm new to NPM (obviously) and I have forked a NPM module to test out some custom modifications to it - let's call that project dependsOnMe. Now i want to use DependsOnMe in my CustomApp project. I can't figure out how to do this.
In my DependsOnMe project I did a npm install -g . (whatever that does, it's now unclear to me), but when I go to my CustomApp project and add a dependency for DependsOnMe into my package.json NPM tells me it cant find DependsOnMe in the NPM remote repo (no kidding...).
Since I installed DependsOnMe globally I thought perhaps I don't need to declare a dependency in MyCustomApp, but when I try to include DependsOnMe in one of my project's .js files I get the error that DependsOnMe cannot be found.
This must be simple, what am I missing?

npm 3.x install fails on rename long paths in Windows/Azure

npm 3.x install fails on rename long paths in Windows/Azure when deploying node.js due to long paths:
npm ERR! EINVAL: invalid argument, rename 'D:\home\site\wwwroot\node_modules\azure_util\node_modules\pkgcloud\node_modules\gcloud\node_modules\gapitoken\node_modules\jws\node_modules\base64url\node_modules\meow\node_modules\indent-string\node_modules\repeating\node_modules\is-finite\node_modules\number-is-nan' -> 'D:\home\site\wwwroot\node_modules\number-is-nan'
Is there away to overcome it or prevent npm from renaming?
We found a solution. It seems like npm 3.x is getting to this situation when it needs to rename a long path only when you upgrade from older npm.
Meaning, since we already had this deployment running with an older npm, when we upgraded to npm 3.6.0 it tried to flatten the existing deployment and crashed.
The solution was just to remove the node_modules and redeploy.
According your info, your custom module azure_util is build in npm <3.x version, which has nested the node_modules folders.
You can try the following steps before deploying your node.js application to Azure Web Apps:
upgrade your local npm version up to 3.x version.
run command npm dedupe in your application directory, which will flatten the tree. You can find the description in npm change log
After these operations, your application's node.js deps should flat list in node_modules folder. And it should prevent the npm rename.
If you still occur the issue on your local env, you can try to rebuild your custom dependency in npm 3.x version, to make the directory tree flat in advance.

Retrieving Node.js Module from GitHub - Error: ENOENT, open package/package.json'

To my understanding, the 'npm' knows about git, so i can use it to retrieve Node.js modules from github. So, I have created Node.js module and hosted it at github. When I try to install it in my Node.js project as following:
npm install git://github.com/git-user/repo.git
then i am getting following error:
Error: ENOENT, open '/Users/kapa/tmp/npm-12237/1371351143597-0.9469406655989587/package/package.json'
...
code ENOENT
npm ERR! errno 34
What am i doing wrong and how to install module from github? Thank You
Does your repository contain a proper package.json file? That is required to have your repository handled as an npm module.
You may be using a .zip file. NPM doesn't support it and it may throw an error. Here is what you can use: https://npmjs.org/doc/install.html#DESCRIPTION
For those who already have a package.json file:
Just in case you didn't notice the comments below the accepted answer, you need to make sure you are inside your app folder to be able to run npm start. It seems to be a common mistake to accidentally run npm start from one directory above. Hope this helps.

Resources