简体   繁体   中英

npm won't install forked git repo

trying to install a forked version of ng2-smart-table for my app but npm is not doing it.

I've used

npm install git+http://github.com/myusername/ng2-smart-table.git
npm install git://github.com/myusername/ng2-smart-table.git
npm install github.com/myusername/ng2-smart-table

and many other variations. I get the following error.

npm ERR! addLocal Could not install /tmp/npm-24904-e690204a/git-cache-97763c70/bb5d603024d75ce8a664d949a646ca7c7c29b0a0
npm ERR! Linux 3.10.0-693.5.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "git://github.com/myusername/ng2-smart-table.git"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10

npm ERR! No version provided in package.json
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/myname/my-app/npm-debug.log
[root@stackc-pre-staging my-app]# vim /home/myname/my-app/npm-debug.log
[root@stackc-pre-staging my-app]# npm install git+http://github.com/myusername/ng2-smart-table.git
npm ERR! addLocal Could not install /tmp/npm-25075-02c22b92/git-cache-ba6c0ee9/bb5d603024d75ce8a664d949a646ca7c7c29b0a0
npm ERR! Linux 3.10.0-693.5.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "git+http://github.com/myusername/ng2-smart-table.git"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10

npm ERR! No version provided in package.json
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/myname/my-app/npm-debug.log

Contents of /home/myname/my-app/npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'install',
1 verbose cli   'git+http://github.com/myusername/ng2-smart-table.git' ]
2 info using npm@3.10.10
3 info using node@v6.11.1
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData git+http://github.com/myusername/ng2-smart-table.git
8 silly fetchOtherPackageData git+http://github.com/myusername/ng2-smart-table.git
9 silly cache add args [ 'git+http://github.com/myusername/ng2-smart-table.git', null ]
10 verbose cache add spec git+http://github.com/myusername/ng2-smart-table.git
11 silly cache add parsed spec Result {
11 silly cache add   raw: 'git+http://github.com/myusername/ng2-smart-table.git',
11 silly cache add   scope: null,
11 silly cache add   escapedName: null,
11 silly cache add   name: null,
11 silly cache add   rawSpec: 'git+http://github.com/myusername/ng2-smart-table.git',
11 silly cache add   spec: 'http://github.com/myusername/ng2-smart-table.git',
11 silly cache add   type: 'git' }
12 verbose addRemoteGit caching git+http://github.com/myusername/ng2-smart-table.git
13 silly tryClone cloning git+http://github.com/myusername/ng2-smart-table.git via git+http://github.com/myusername/ng2-smart-table.git
14 verbose tryClone git-http-github-com-myusername-ng2-smart-table-git-6513bc33 not in flight; caching
15 verbose correctMkdir /root/.npm/_git-remotes correctMkdir not in flight; initializing
16 info git [ 'clone',
16 info git   '--template=/root/.npm/_git-remotes/_templates',
16 info git   '--mirror',
16 info git   'http://github.com/myusername/ng2-smart-table.git',
16 info git   '/root/.npm/_git-remotes/git-http-github-com-myusername-ng2-smart-table-git-6513bc33' ]
17 verbose mirrorRemote git+http://github.com/myusername/ng2-smart-table.git git clone http://github.com/myusername/ng2-smart-table.git Cloning into bare repository '/root/.npm/_git-remotes/git-http-github-com-myusername-ng2-smart-table-git-6513bc33'...
18 verbose correctMkdir /root/.npm/_git-remotes correctMkdir not in flight; initializing
19 verbose setPermissions git+http://github.com/myusername/ng2-smart-table.git set permissions on /root/.npm/_git-remotes/git-http-github-com-myusername-ng2-smart-table-git-6513bc33
20 verbose resolveHead git+http://github.com/myusername/ng2-smart-table.git original treeish: master
21 info git [ 'rev-list', '-n1', 'master' ]
22 silly resolveHead git+http://github.com/myusername/ng2-smart-table.git resolved treeish: bb5d603024d75ce8a664d949a646ca7c7c29b0a0
23 verbose resolveHead git+http://github.com/myusername/ng2-smart-table.git resolved Git URL: git+ssh://git@github.com/myusername/ng2-smart-table.git#bb5d603024d75ce8a664d949a646ca7c7c29b0a0
24 silly resolveHead Git working directory: /tmp/npm-25075-02c22b92/git-cache-ba6c0ee9/bb5d603024d75ce8a664d949a646ca7c7c29b0a0
25 info git [ 'clone',
25 info git   '/root/.npm/_git-remotes/git-http-github-com-myusername-ng2-smart-table-git-6513bc33',
25 info git   '/tmp/npm-25075-02c22b92/git-cache-ba6c0ee9/bb5d603024d75ce8a664d949a646ca7c7c29b0a0' ]
26 verbose cloneResolved git+http://github.com/myusername/ng2-smart-table.git clone Cloning into '/tmp/npm-25075-02c22b92/git-cache-ba6c0ee9/bb5d603024d75ce8a664d949a646ca7c7c29b0a0'...
26 verbose cloneResolved done.
27 info git [ 'checkout', 'bb5d603024d75ce8a664d949a646ca7c7c29b0a0' ]
28 verbose checkoutTreeish git+http://github.com/myusername/ng2-smart-table.git checkout Note: checking out 'bb5d603024d75ce8a664d949a646ca7c7c29b0a0'.
28 verbose checkoutTreeish
28 verbose checkoutTreeish You are in 'detached HEAD' state. You can look around, make experimental
28 verbose checkoutTreeish changes and commit them, and you can discard any commits you make in this
28 verbose checkoutTreeish state without impacting any branches by performing another checkout.
28 verbose checkoutTreeish
28 verbose checkoutTreeish If you want to create a new branch to retain commits you create, you may
28 verbose checkoutTreeish do so (now or later) by using -b with the checkout command again. Example:
28 verbose checkoutTreeish
28 verbose checkoutTreeish   git checkout -b new_branch_name
28 verbose checkoutTreeish
28 verbose checkoutTreeish HEAD is now at bb5d603... Added a show/hide variable to column settings so that you can toggle visibility of columns
29 info git [ 'submodule', '-q', 'update', '--init', '--recursive' ]
30 verbose updateSubmodules git+http://github.com/myusername/ng2-smart-table.git submodule update
31 error addLocal Could not install /tmp/npm-25075-02c22b92/git-cache-ba6c0ee9/bb5d603024d75ce8a664d949a646ca7c7c29b0a0
32 silly fetchPackageMetaData Error: No version provided in package.json
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/lib/cache/add-local.js:73:17
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:356:5
32 silly fetchPackageMetaData     at checkBinReferences_ (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:320:45)
32 silly fetchPackageMetaData     at final (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:354:3)
32 silly fetchPackageMetaData     at then (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:124:5)
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:243:12
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/node_modules.bundled/graceful-fs/graceful-fs.js:78:16
32 silly fetchPackageMetaData     at tryToString (fs.js:456:3)
32 silly fetchPackageMetaData     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
32 silly fetchPackageMetaData  error for git+http://github.com/myusername/ng2-smart-table.git Error: No version provided in package.json
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/lib/cache/add-local.js:73:17
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:356:5
32 silly fetchPackageMetaData     at checkBinReferences_ (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:320:45)
32 silly fetchPackageMetaData     at final (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:354:3)
32 silly fetchPackageMetaData     at then (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:124:5)
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:243:12
32 silly fetchPackageMetaData     at /usr/lib/node_modules/npm/node_modules.bundled/graceful-fs/graceful-fs.js:78:16
32 silly fetchPackageMetaData     at tryToString (fs.js:456:3)
32 silly fetchPackageMetaData     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
33 silly rollbackFailedOptional Starting
34 silly rollbackFailedOptional Finishing
35 silly runTopLevelLifecycles Finishing
36 silly install printInstalled
37 verbose stack Error: No version provided in package.json
37 verbose stack     at /usr/lib/node_modules/npm/lib/cache/add-local.js:73:17
37 verbose stack     at /usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:356:5
37 verbose stack     at checkBinReferences_ (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:320:45)
37 verbose stack     at final (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:354:3)
37 verbose stack     at then (/usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:124:5)
37 verbose stack     at /usr/lib/node_modules/npm/node_modules.bundled/read-package-json/read-json.js:243:12
37 verbose stack     at /usr/lib/node_modules/npm/node_modules.bundled/graceful-fs/graceful-fs.js:78:16
37 verbose stack     at tryToString (fs.js:456:3)
37 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
38 verbose cwd /home/myname/my-app
39 error Linux 3.10.0-693.5.2.el7.x86_64
40 error argv "/usr/bin/node" "/usr/bin/npm" "install" "git+http://github.com/myusername/ng2-smart-table.git"
41 error node v6.11.1
42 error npm  v3.10.10
43 error No version provided in package.json
44 error If you need help, you may report this error at:
44 error     <https://github.com/npm/npm/issues>
45 verbose exit [ 1, true ]

Is this a permissions issue? Or is there something wrong with the way npm is set up? Any help would be appreciated.

Problem 1: The repo on your post does not exist.

You might've used the wrong repo url. Use the correct repo url: https://github.com/akveo/ng2-smart-table

Problem 2: The repo does not have a version specified in the package.json

Just fork it and add a version in the package.json file.

Or, use the npm version,

npm install --save ng2-smart-table

Try recreating package.json for that repo with npm init . command and go through all the steps.
Remember having correct repository link in the repository section. I had the same problem but above helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM