Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"premature close" error during npm install from git url #1

Closed
alundiak opened this issue May 18, 2018 · 10 comments · May be fixed by #2
Closed

"premature close" error during npm install from git url #1

alundiak opened this issue May 18, 2018 · 10 comments · May be fixed by #2

Comments

@alundiak
Copy link

alundiak commented May 18, 2018

I know/see, that this repo doesn't have package.json, and I do

npm install https://github.com/coryetzkorn/state-svg-defs.git 

Also tried ssh. Same result.

I'm from MacOS v10.13.4 have node v10.1.0 and npm v6.0.1 and it throws me an error:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'https://github.com/coryetzkorn/state-svg-defs.git' ]
2 info using npm@6.0.1
3 info using node@v10.1.0
4 verbose npm-session ae24ebb0b4f63570
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for git+https://github.com/coryetzkorn/state-svg-defs.git premature close
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 1948ms
10 verbose stack Error: premature close
10 verbose stack     at PassThrough.onclose (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/end-of-stream/index.js:47:67)
10 verbose stack     at PassThrough.emit (events.js:187:15)
10 verbose stack     at emitCloseNT (internal/streams/destroy.js:59:8)
10 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
11 verbose cwd /Users/alund/prj/test-install
12 verbose Darwin 17.5.0
13 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "https://github.com/coryetzkorn/state-svg-defs.git"
14 verbose node v10.1.0
15 verbose npm  v6.0.1
16 error premature close
17 verbose exit [ 1, true ]

As I understand it's either npm issue with package with no package.json or smth else.

I found similar issues in npm, but looks like ti was solved in node v8:

@coryetzkorn as a suggestion, I would recommend you to add package.json and publish this module. I'm using it for my work related project, and recently I moved stateface from Bower (https://github.com/propublica/stateface) to NPM, but, in fact I found that SVG files are using from this repository. I still working on my task, and maybe I will get rid of using files from your repo and reuse dmn-stateface module (https://github.com/DallasMorningNews/stateface which is fork from probulica repo but published as npm module)

PS. Here is log from Node 6.x and npm 3.x on Windows 7, and it's about another error EISDIR:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\andrii.lundiak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'https://github.com/coryetzkorn/state-svg-defs.git' ]
2 info using npm@3.8.3
3 info using node@v6.12.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData https://github.com/coryetzkorn/state-svg-defs.git
8 silly fetchOtherPackageData https://github.com/coryetzkorn/state-svg-defs.git
9 silly cache add args [ 'https://github.com/coryetzkorn/state-svg-defs.git', null ]
10 verbose cache add spec https://github.com/coryetzkorn/state-svg-defs.git
11 silly cache add parsed spec Result {
11 silly cache add   raw: 'https://github.com/coryetzkorn/state-svg-defs.git',
11 silly cache add   scope: null,
11 silly cache add   name: null,
11 silly cache add   rawSpec: 'https://github.com/coryetzkorn/state-svg-defs.git',
11 silly cache add   spec: 'git+https://github.com/coryetzkorn/state-svg-defs.git',
11 silly cache add   type: 'hosted',
11 silly cache add   hosted:
11 silly cache add    { type: 'github',
11 silly cache add      ssh: 'git@github.com:coryetzkorn/state-svg-defs.git',
11 silly cache add      sshUrl: 'git+ssh://git@github.com/coryetzkorn/state-svg-defs.git',
11 silly cache add      httpsUrl: 'git+https://github.com/coryetzkorn/state-svg-defs.git',
11 silly cache add      gitUrl: 'git://github.com/coryetzkorn/state-svg-defs.git',
11 silly cache add      shortcut: 'github:coryetzkorn/state-svg-defs',
11 silly cache add      directUrl: 'https://raw.githubusercontent.com/coryetzkorn/state-svg-defs/master/package.json' } }
12 verbose addRemoteGit caching https://github.com/coryetzkorn/state-svg-defs.git
13 verbose addRemoteGit git+https://github.com/coryetzkorn/state-svg-defs.git is a repository hosted by github
14 silly tryClone cloning git+https://github.com/coryetzkorn/state-svg-defs.git via git+https://github.com/coryetzkorn/state-svg-defs.git
15 verbose tryClone git-https-github-com-coryetzkorn-state-svg-defs-git-16ae7e8e not in flight; caching
16 verbose correctMkdir C:\Users\andrii.lundiak\AppData\Roaming\npm-cache\_git-remotes correctMkdir not in flight; initializing
17 info git [ 'config', '--get', 'remote.origin.url' ]
18 silly validateExistingRemote git+https://github.com/coryetzkorn/state-svg-defs.git remote.origin.url: https://github.com/coryetzkorn/state-svg-defs.git
19 verbose validateExistingRemote git+https://github.com/coryetzkorn/state-svg-defs.git is updating existing cached remote C:\Users\andrii.lundiak\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-coryetzkorn-state-svg-defs-git-16ae7e8e
20 info git [ 'fetch', '-a', 'origin' ]
21 verbose updateRemote git fetch -a origin (https://github.com/coryetzkorn/state-svg-defs.git)
22 verbose setPermissions git+https://github.com/coryetzkorn/state-svg-defs.git skipping chownr on Windows
23 verbose resolveHead git+https://github.com/coryetzkorn/state-svg-defs.git original treeish: master
24 info git [ 'rev-list', '-n1', 'master' ]
25 silly resolveHead git+https://github.com/coryetzkorn/state-svg-defs.git resolved treeish: 5e5141e6117c793abf1892d0e4c8a4ebb76b032a
26 verbose resolveHead git+https://github.com/coryetzkorn/state-svg-defs.git resolved Git URL: git+https://github.com/coryetzkorn/state-svg-defs.git#5e5141e6117c793abf1892d0e4c8a4ebb76b032a
27 silly resolveHead Git working directory: C:\Users\ANDRII~1.LUN\AppData\Local\Temp\npm-6716-3fdd19dd\git-cache-bd2770ce\5e5141e6117c793abf1892d0e4c8a4ebb76b032a
28 info git [ 'clone',
28 info git   'C:\\Users\\andrii.lundiak\\AppData\\Roaming\\npm-cache\\_git-remotes\\git-https-github-com-coryetzkorn-state-svg-defs-git-16ae7e8e',
28 info git   'C:\\Users\\ANDRII~1.LUN\\AppData\\Local\\Temp\\npm-6716-3fdd19dd\\git-cache-bd2770ce\\5e5141e6117c793abf1892d0e4c8a4ebb76b032a' ]
29 verbose cloneResolved git+https://github.com/coryetzkorn/state-svg-defs.git clone Cloning into 'C:\Users\ANDRII~1.LUN\AppData\Local\Temp\npm-6716-3fdd19dd\git-cache-bd2770ce\5e5141e6117c793abf1892d0e4c8a4ebb76b032a'...
29 verbose cloneResolved done.
30 info git [ 'checkout', '5e5141e6117c793abf1892d0e4c8a4ebb76b032a' ]
31 verbose checkoutTreeish git+https://github.com/coryetzkorn/state-svg-defs.git checkout Note: checking out '5e5141e6117c793abf1892d0e4c8a4ebb76b032a'.
31 verbose checkoutTreeish
31 verbose checkoutTreeish You are in 'detached HEAD' state. You can look around, make experimental
31 verbose checkoutTreeish changes and commit them, and you can discard any commits you make in this
31 verbose checkoutTreeish state without impacting any branches by performing another checkout.
31 verbose checkoutTreeish
31 verbose checkoutTreeish If you want to create a new branch to retain commits you create, you may
31 verbose checkoutTreeish do so (now or later) by using -b with the checkout command again. Example:
31 verbose checkoutTreeish
31 verbose checkoutTreeish   git checkout -b <new-branch-name>
31 verbose checkoutTreeish
31 verbose checkoutTreeish HEAD is now at 5e5141e Capitalization
32 info git [ 'submodule', '-q', 'update', '--init', '--recursive' ]
33 verbose updateSubmodules git+https://github.com/coryetzkorn/state-svg-defs.git submodule update
34 error addLocal Could not install C:\Users\ANDRII~1.LUN\AppData\Local\Temp\npm-6716-3fdd19dd\git-cache-bd2770ce\5e5141e6117c793abf1892d0e4c8a4ebb76b032a
35 silly fetchPackageMetaData Error: EISDIR: illegal operation on a directory, read
35 silly fetchPackageMetaData     at Error (native)
35 silly fetchPackageMetaData  error for https://github.com/coryetzkorn/state-svg-defs.git { Error: EISDIR: illegal operation on a directory, read
35 silly fetchPackageMetaData     at Error (native) errno: -4068, code: 'EISDIR', syscall: 'read' }
36 silly rollbackFailedOptional Starting
37 silly rollbackFailedOptional Finishing
38 silly runTopLevelLifecycles Starting
39 silly runTopLevelLifecycles Finishing
40 silly install printInstalled
41 verbose stack Error: EISDIR: illegal operation on a directory, read
41 verbose stack     at Error (native)
42 verbose cwd C:\IdeaProjects\partnerselect\ps-core-web-glu
43 error Windows_NT 6.1.7601
44 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\andrii.lundiak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/coryetzkorn/state-svg-defs.git"
45 error node v6.12.0
46 error npm  v3.8.3
47 error code EISDIR
48 error errno -4068
49 error syscall read
50 error eisdir EISDIR: illegal operation on a directory, read
51 error eisdir This is most likely not a problem with npm itself
51 error eisdir and is related to npm not being able to find a package.json in
51 error eisdir a package you are trying to install.
52 verbose exit [ -4068, true ]

@ghost
Copy link

ghost commented Jul 3, 2018

Same Problem
Do not tell me use yarn
We are talking about npm

@Asfolny
Copy link

Asfolny commented Jan 28, 2019

I feel the need to comment this out for anyone who finds this into the future and arrives here confused like me;
The issue is the lack of a package.json in the 'module' you want to install (see npm issue#20824) and seems to be impacting only npm install

I could tell you to use yarn or to just clone the repo, it doesn't seem like anything will happen anytime to it soon tbh, or just wait and see for a pull merge

@stuk88
Copy link

stuk88 commented Apr 4, 2019

I feel the need to comment this out for anyone who finds this into the future and arrives here confused like me;
The issue is the lack of a package.json in the 'module' you want to install (see npm issue#20824) and seems to be impacting only npm install

I could tell you to use yarn or to just clone the repo, it doesn't seem like anything will happen anytime to it soon tbh, or just wait and see for a pull merge

THANKS A LOT!!!

@tomavic
Copy link

tomavic commented Jul 30, 2019

Any updates

@patrickhrastnik
Copy link

This happened for me when my package was missing a package.json
Execute npm init to create one (it will automatically guide you through the process).

@patrickhrastnik
Copy link

see Pull Request #2

@deftdawg
Copy link

I got this when the git repo I was pulling in had an extra comma within it's packages.json.

i.e. I was pulling in github:deftdawg/jexcel#patch-implement-checkbox-filtering and the
https://github.com/deftdawg/jexcel/blob/patch-implement-checkbox-filtering/package.json had an extra comma... Per the fix patch below:

diff --git a/package.json b/package.json
index 0857fae..8df9c04 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
         "data-spreadsheet"
     ],
     "dependencies": {
-        "jsuites": "github:deftdawg/jsuites",
+        "jsuites": "github:deftdawg/jsuites"
     },
     "main": "dist/jexcel.js",
     "version": "4.3.0",

@eepp
Copy link

eepp commented Sep 13, 2020

@deftdawg Thanks a lot! You saved me so much time!

"premature close" certainly is a very detailed error message... 😒

MartinLoeper added a commit to nesto-software/aws-greengrass-core-sdk-js that referenced this issue Oct 7, 2020
@arekgotfryd
Copy link

This happened for me when my package was missing a package.json
Execute npm init to create one (it will automatically guide you through the process).

Also remember to have correct repository link in repository section of package.json

@alundiak
Copy link
Author

alundiak commented May 4, 2021

  • npm i state-svg-defs - still doesn't work.

  • npm i https://github.com/coryetzkorn/state-svg-defs.git - still doesn't work.

  • npm i git@github.com:coryetzkorn/state-svg-defs.git - still doesn't work

  • yarn add state-svg-defs - doesn't work.

yarn add v1.22.4
info No lockfile found.
[1/4] 🔍 Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/state-svg-defs: Not found".

  • yarn add git@github.com:coryetzkorn/state-svg-defs.git - not working, because it's not proper yarn add format. Install git instead.

yarn add v1.22.4
info No lockfile found.
[1/4] 🔍 Resolving packages...
Couldn't find any versions for "git" that matches "github.com:coryetzkorn/state-svg-defs.git"
? Please choose a version of "git" from this list: 0.1.5
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
info Direct dependencies
└─ git@0.1.5
info All dependencies
├─ git@0.1.5
└─ mime@1.2.9
✨ Done in 11.59s.

  • yarn add https://github.com/coryetzkorn/state-svg-defs.git the only one way works. But it's not what planned/expected from issue description (root casue).

yarn add v1.22.4
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ state-svg-defs@0.0.0
info All dependencies
└─ state-svg-defs@0.0.0
✨ Done in 4.04s.

Screenshot 2021-05-04 at 20 11 55

Sure thing, master branch not updated since 2017, so it looks the package not maintained. So I do close this my issue, coz seem to be not relevant at all.

@alundiak alundiak closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants