Viewed   656 times

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 the vendor-name repository contains a package.json.

If there's not such a file, I get:

npm ERR! path /var/folders/0l/temp-folder/package.json
npm ERR! code ENOENT

Actually, a npm install git://github.com/vendor/name.git#v1.1 does not work, too.

So my question is: Is there a way to install (include) git repositories (in the dependencies) that do not have a package.json?

 Answers

1

Yes you can with this package: https://npmjs.org/package/napa

Wednesday, October 5, 2022
 
urkman
 
2

From the man file:

When --cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index.

So, for a single file:

git rm --cached mylogfile.log

and for a single directory:

git rm --cached -r mydirectory
Saturday, October 8, 2022
 
3

Try npm install <ghusername>/<repoName>, where <ghUsername> is your GitHub username (without the @) and <repoName> is the name of the repository. That should correctly install it. You will most likely want to use the --save or --save-dev flag with the install command to save dependency in your package.json.

If that isn't working correctly, check the contents of your .npmignore file.

Don't panic if the install command takes a long time; installing from a git repository is slower than installing from the npm registry.


Edit:

Your problem is that in your case, dist/ is not committed to the repo (since it is in the .gitignore). That is where the actual code lives. dist/ is built from the files in src/ before the package is published to the npm registry, but dist/ is never committed to the repo.

It's ugly, but in this case you will have to remove dist/ from the .gitignore and then run:

npm run build
git add .
git commit
git push

(Ensure that you have run npm install first)

You then should be able to install from github.

There might be another way to do this using a postinstall script, but I'm not sure if that's possible; I've never tried it.

Wednesday, November 23, 2022
3

npm checks all directories for the existance of a .git directory, and throws the EISGIT error if it exists, so there is no way to ignore it or skip it.

The code does however check if it's a link:

mod.parent && !mod.isLink && [checkGit, mod.realpath],

So I was able to make it work by symlinking the module into node_modules.

$ ln -s ../some-module node_modules
Saturday, September 10, 2022
 
nilzen
 
5

npm has a progress configuration key. It is described as follows:

progress

  • Default: true, unless TRAVIS or CI env vars set.
  • Type: Boolean

When set to true, npm will display a progress bar during time intensive operations, if process.stderr is a TTY.

Set to false to suppress the progress bar.

Perhaps it has inadvertently been set to false.

To get/set the progress configuration you can utilize the npm-config command:

  1. Check its current setting by running:

    npm config get progress
    
  2. If the aforementioned command returns false then set it to true by running:

    npm config set progress true
    

Note: git-bash may be classified as a "dumb terminal"

I have git-bash installed on an earlier version of Windows and when I run:

npm config get progress

it returned:

undefined

Setting it to true made no difference, i.e. it does not get a progress bar.

I assume my terminal (git-bash) is dumb, i.e. a progress bar is not supported. Yours may be dumb too !

Monday, September 26, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :