All Questions
1,052
questions
2481
votes
15
answers
1.1m
views
Do I commit the package-lock.json file created by npm 5?
npm 5 was released today and one of the new features include deterministic installs with the creation of a package-lock.json file.
Is this file supposed to be kept in source control?
I'm assuming it'...
483
votes
6
answers
316k
views
Depend on a branch or tag using a git URL in a package.json?
Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released.
How would I reference my fixed version in the ...
403
votes
12
answers
197k
views
Should I check in folder "node_modules" to Git when creating a Node.js app on Heroku?
I followed the basic getting started instructions for Node.js on Heroku here:
https://devcenter.heroku.com/categories/nodejs
These instructions don't tell you to create a .gitignore node_modules, and ...
303
votes
18
answers
255k
views
update package.json version automatically
Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program.
Is there a way to edit the file package.json automatically?
Would using a git ...
296
votes
8
answers
201k
views
How to use private Github repo as npm dependency
How do I list a private Github repo as a "dependency" in package.json? I tried npm's Github URLs syntaxes like ryanve/example, but doing npm install in the package folder gives "could not install" ...
245
votes
4
answers
189k
views
How can I publish an npm package with distribution files?
I would like to publish a npm package that contains my source as well as distribution files. My GitHub repository contains src folder which contains JavaScript source files. The build process ...
218
votes
9
answers
96k
views
Should "node_modules" folder be included in the git repository
I'm wondering if we should be tracking node_modules in our repo or doing an npm install when checking out the code?
199
votes
1
answer
205k
views
Should the package-lock.json file be added to .gitignore? [duplicate]
To lock the versions of dependencies that are installed over a project, the command npm install creates a file called package-lock.json. This was made since Node.js v8.0.0 and npm v5.0.0, as several ...
161
votes
4
answers
74k
views
How do you resolve Git conflicts in yarn.lock
When multiple Git branches modify the dependencies in a project that uses Yarn, it is likely to introduce a conflict in the yarn.lock file. It is not a good idea to delete and regenerate the yarn.lock ...
158
votes
11
answers
145k
views
Install npm module from gitlab private repository
We are using GitLab for our private project. There are some forked libraries from github, that we want to install as npm module. Installing that module directly from npm is ok and for example this:
...
101
votes
28
answers
391k
views
SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
Since a few days I got an issue with Mac OS High Sierra 10.13.3 :
When I run a git clone like git clone github.com/xxx.git failed
it print:
LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to ...
94
votes
2
answers
40k
views
Does NPM ignore files listed in .gitignore?
I have a file that is generated by npm install command (using preinstall task). I don't want to add it in the git repository, nor in the NPM project.
Supposing the file name is foo.json, I added it ...
88
votes
11
answers
160k
views
sh: husky: command not found
I've setup a node project with husky but when my collegue tries to run npm install on his Mac he gets the following error :
[email protected] prepare
husky install
sh: husky: command not found
npm ERR! ...
87
votes
6
answers
43k
views
npm install package from github repo subfolder
Is it possible to install npm package from github when the package located inside subfolder?
For example, we have Microsoft BotBuilder repository:
https://github.com/Microsoft/BotBuilder
But I need ...
56
votes
5
answers
29k
views
avoid rebuilding node_modules in elastic beanstalk
We have a fairly simple node.js app, but due to AWS Elastic Beanstalk deployment mechanism, it takes about 5 minutes to roll-out a new version (via git aws.push) even after a single file commit.
I.e. ...
53
votes
16
answers
177k
views
How come npm install doesn't work on git bash
I have git bash open and I type in npm install and then it returns:
bash: npm command not found
I don't understand, because I have node.js command prompt and when I type in npm -v then it returns 3....
46
votes
8
answers
104k
views
How to build Docker Images with Dockerfile behind HTTP_PROXY by Jenkins?
Building Docker images works in a desktop without a problem. Installing Node.js NPM dependencies work as usual. However, when using a continuous integration server such as Jenkins that is hosted ...
44
votes
2
answers
50k
views
Can't make git stop tracking package-lock.json
With npm v5 here is now package-lock.json file being created after npm install
It is recommended to commit this file, but I have issue that this file is different for some reason between my dev ...
44
votes
2
answers
14k
views
Do I need to publish to npm every time I update a package available via git?
Say I maintain an incredible crab-season package. I've npm published version 0.1.0 with a package.json containing:
"repository": {
"type": "git",
"url": "https://github.com/example/crab-season....
41
votes
4
answers
16k
views
npm outdated output colour-coding meaning
I run git command npm outdated in bash on a mac.
See the output in the image below.
Does anyone know why the first four packages are printed in red?
I guess it's because I have them pointing to ...
38
votes
4
answers
21k
views
npm install git repository without package.json
I have a project that depends on several third-party libs.
My package.json looks like:
"dependencies": {
"vendor-name": "git://github.com/vendor/name.git#v1.1",
...
}
This works as long as ...
37
votes
4
answers
47k
views
Is there a way to specify which ssh key should be used for npm install
I have a private repo that I want to install in my package.json file.
"private-module": "git+ssh://[email protected]:private/private-module.git"
By default npm uses your default private key. I want ...
36
votes
7
answers
97k
views
npm ERR! git dep preparation failed when trying to install package.json
I'm trying to install package.json file using the command npm install, but I'm getting the following error.
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\...
35
votes
1
answer
19k
views
What's the difference between .npmignore and .gitignore?
What's the difference between .npmignore and .gitignore? What kind of files should I ignore in each?
32
votes
7
answers
62k
views
Use Git dependencies with npm and Node on Heroku
I have this package.json file:
{
"name": "application-name"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"coffee-script": "1.1.3"
, "express": "2.5.0"
, "less": "...
32
votes
14
answers
130k
views
npm install error code 128
I am receiving the following error when trying to run npm install after a fresh install of Node and Git
Anyone have any idea what could be causing it, and what to do to fix it?
package.json (removed ...
32
votes
5
answers
16k
views
How to update npm modules, ignoring a git repo
I forked one of npm modules and now it is a git repo.
So my package.json:
"dependencies": {
"some-module": "git+https://github.com/my-name/some-module.git",
}
Forked repo is synchronized by ...
30
votes
7
answers
50k
views
Why do I obtain this error when deploying app to Heroku?
I am getting some kind of error when deploying my app to heroku using git hub. The problem is, I don't understand the heroku logs and the entailing errors. Here is the heroku log:
Marcuss-MacBook-...
30
votes
10
answers
76k
views
npm install giving error while accessing GIT url
my package.json has the following dependency,
{
"name": "AppName",
"version": "0.0.0",
"description": "App Description",
"author": "@author",
"dependencies": {},
"devDependencies": {
...
26
votes
5
answers
11k
views
No console colors if using npm script inside a Git bash (mintty)
Introduction
Using chalk I have written a small console program for printing colored text, which I execute with NodeJS:
console.log(require('chalk').yellow('yellow text'));
The program prints the ...
25
votes
4
answers
38k
views
How to add a git repo in package.json file
I have an app where I didn't add its repository in package.json while doing npm init.
Now I want to add repo in the package.json file, but couldn't find helpful solutions for me.
Also, I found ...
23
votes
3
answers
34k
views
npm scripts ignore errors
I currently have a npm script for running a linter. Obviously there will be some errors being outputted, but the npm script fails rather than just show me errors and move on.
This is terrible ...
22
votes
4
answers
38k
views
npm install returns syscall spawn git error
I've tried to run npm install and faced these issues below
I've tried to clear cache with force command, install git and update node but nothing worked
here is the error
npm ERR! code ENOENT
npm ...
22
votes
2
answers
32k
views
npm install shows error with git not found
I have recently added some dependencies to the package JSON and tried installing npm, but it shows errors related to git not found:
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ...
19
votes
2
answers
24k
views
npm install dependencies of a git submodule
I've got a git project with handlebars.js as a submodule. I will provide here a bare-bones example - the full project is more complicated with dojo tasks and deployment steps that aren't relevant ...
19
votes
5
answers
8k
views
Does every git branch of an NPM project have different node_modules dependencies?
I assume that when developing an NPM project, that every git branch (or whatever version control system you use) probably points to a different set of node_modules on the filesystem. Is that true? How ...
19
votes
5
answers
11k
views
Skip pre-commit hook in "npm version" command
npm version commits the change to package.json and creates a tag. Is there a way to prevent commit hook from being executed while using this command?
19
votes
1
answer
15k
views
NPM install : Git URL dependency error in package.json
I want to set a dependency that is a Git URL of a private package in package.json I write :
"dependencies" : {
"mymodule" : "git://[email protected]:/myproject#mybranch"
}
When running npm ...
19
votes
5
answers
17k
views
Make npm fetch latest package from Git repo
My question is similar to this one.
A project has a dependency on a Git module which resides in a privately-hosted repository:
"dependencies": {
"mymod": "git+https://mygitserver:8443/scm/od/mymod....
19
votes
2
answers
6k
views
How to install git hooks on "npm install"?
I'd like to install a pre-commit git hook (that lints the code) when someone installs my-package.
I tried to add a postinstall script:
"scripts": {
"postinstall": "./scripts/install-git-hooks"
}
...
19
votes
1
answer
418
views
What is the correct way with NPM to package a BUILT version of a forked Git repository?
I recently forked a GitHub repository to fix a problem, and created a pull request. While I wait for the pull request to be accepted, I have pointed my local package.json at my forked repo, like so:
...
18
votes
3
answers
17k
views
npm install from git use https instead ssh
I have an application with the following package.json file
"dependencies": {
"package_name": "git+ssh://[email protected]:Domain/package_name.git",
}
I can't change it and I can't use ssh. ...
18
votes
1
answer
6k
views
Customize Commit message while using npm version patch
Is it possible to customize the commit message while using npm version patch?
I' d like to change it to :up-arrow: @VERSIONNUMBER
18
votes
1
answer
6k
views
npm install from git repo subfolder
I have a repo with various components and I want to be able to include the components as individual dependencies (but I don't want to create a repo per component).
Is it a way to use a subfolder of a ...
17
votes
6
answers
11k
views
npm git protocol dependencies
At work we are behind an HTTP Proxy and the git protocol (port 9418) is denied.
My project has NPM dependencies and some of these dependencies have dependencies that use the git protocol, for ...
17
votes
4
answers
37k
views
Suitable `.gitignore` For Node.js
Tree structure
That's how my Node.js project is organized:
/
| - node_modules [+ INCLUDE]
| | - my-mod1
| | | - node_modules [- IGNORE]
| | | | - external-mod1
| | ...
16
votes
4
answers
16k
views
Github actions err: bash: line 3: npm: command not found
I am trying to deploy a nodejs app from github to a remote ubuntu server via ssh. Here is my main.yml:
name: Node Github CI
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ...
15
votes
1
answer
9k
views
How to push to github with custom commit message with npm scripts?
In my package.json I have this
"scripts": {
"start": "gulp serve",
"git": "git add . && git commit -m 'some-message' && git push --all"
},
In the terminal I run npm run ...
15
votes
1
answer
7k
views
How to pull NPM dependency from private GitLab Git repo during GitLab CI build
I have a job in my .gitlab-ci.yml file which does an npm install like so:
test:
image: node:10
script:
- npm install
- npm test
The problem is that I'm referencing a private GitLab repo ...
15
votes
2
answers
10k
views
How to support multiple private npm packages living in one git repo?
npm is very good at supporting packages publishes to the global/central npm repo, which doesn't work well for private, application code. npm also supports adding a git repo as a dependency, which ...