简体   繁体   English

从git repo运行软件包的'npm install'时出错

[英]Error when running 'npm install' for a package from a git repo

This is killing me. 这真杀了我。 After entering the following in the command line: 在命令行中输入以下内容后:

> npm install git+https://github.com/jshint/jshint.git

I get the following command-line error ... 我收到以下命令行错误 ...

npm ERR! addLocal Could not install D:\Users\Niko\AppData\Roaming\npm\npm_temp\npm-12692-e02bf6f0\git-cache-60d903b5b73a\561d9785cdca88fc0a3178795274207520d05596
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "node" "D:\\Users\\Niko\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "git+https://github.com/jshint/jshint.git"
npm ERR! node v0.12.4
npm ERR! npm  v2.13.2
npm ERR! path D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz
npm ERR! code ENOENT
npm ERR! errno -4058

npm ERR! enoent ENOENT, scandir 'D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     C:\repos\UNTRACKED\MyPackage\npm-debug.log

npm-debug.log ... npm-debug.log ...

0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli   'D:\\Users\\Niko\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'git+https://github.com/jshint/jshint.git' ]
2 info using npm@2.13.2
3 info using node@v0.12.4
4 verbose install initial load of C:\repos\UNTRACKED\MyPackage\package.json
5 verbose readDependencies loading dependencies from C:\repos\UNTRACKED\MyPackage\package.json
6 silly cache add args [ 'git+https://github.com/jshint/jshint.git', null ]
7 verbose cache add spec git+https://github.com/jshint/jshint.git
8 silly cache add parsed spec { raw: 'git+https://github.com/jshint/jshint.git',
8 silly cache add   scope: null,
8 silly cache add   name: null,
8 silly cache add   rawSpec: 'git+https://github.com/jshint/jshint.git',
8 silly cache add   spec: 'git+https://github.com/jshint/jshint.git',
8 silly cache add   type: 'hosted',
8 silly cache add   hosted:
8 silly cache add    { type: 'github',
8 silly cache add      ssh: 'git@github.com:jshint/jshint.git',
8 silly cache add      sshUrl: 'git+ssh://git@github.com/jshint/jshint.git',
8 silly cache add      httpsUrl: 'git+https://github.com/jshint/jshint.git',
8 silly cache add      gitUrl: 'git://github.com/jshint/jshint.git',
8 silly cache add      shortcut: 'github:jshint/jshint',
8 silly cache add      directUrl: 'https://raw.githubusercontent.com/jshint/jshint/master/package.json' } }
9 verbose addRemoteGit caching git+https://github.com/jshint/jshint.git
10 verbose addRemoteGit git+https://github.com/jshint/jshint.git is a repository hosted by github
11 silly tryClone cloning git+https://github.com/jshint/jshint.git via git+https://github.com/jshint/jshint.git
12 verbose tryClone https-github-com-jshint-jshint-git-e872a8ff not in flight; caching
13 info git [ 'config', '--get', 'remote.origin.url' ]
14 silly validateExistingRemote git+https://github.com/jshint/jshint.git remote.origin.url: https://github.com/jshint/jshint.git
15 verbose validateExistingRemote git+https://github.com/jshint/jshint.git is updating existing cached remote D:\Users\Niko\AppData\Roaming\npm-cache\_git-remotes\https-github-com-jshint-jshint-git-e872a8ff
16 info git [ 'fetch', '-a', 'origin' ]
17 verbose updateRemote git fetch -a origin (https://github.com/jshint/jshint.git)
18 verbose setPermissions git+https://github.com/jshint/jshint.git skipping chownr on Windows
19 verbose resolveHead git+https://github.com/jshint/jshint.git original treeish: master
20 info git [ 'rev-list', '-n1', 'master' ]
21 silly resolveHead git+https://github.com/jshint/jshint.git resolved treeish: 561d9785cdca88fc0a3178795274207520d05596
22 verbose resolveHead git+https://github.com/jshint/jshint.git resolved Git URL: git+https://github.com/jshint/jshint.git#561d9785cdca88fc0a3178795274207520d05596
23 silly resolveHead Git working directory: D:\Users\Niko\AppData\Roaming\npm\npm_temp\npm-12692-e02bf6f0\git-cache-60d903b5b73a\561d9785cdca88fc0a3178795274207520d05596
24 info git [ 'clone',
24 info git   'D:\\Users\\Niko\\AppData\\Roaming\\npm-cache\\_git-remotes\\https-github-com-jshint-jshint-git-e872a8ff',
24 info git   'D:\\Users\\Niko\\AppData\\Roaming\\npm\\npm_temp\\npm-12692-e02bf6f0\\git-cache-60d903b5b73a\\561d9785cdca88fc0a3178795274207520d05596' ]
25 verbose cloneResolved git+https://github.com/jshint/jshint.git clone Cloning into 'D:\Users\Niko\AppData\Roaming\npm\npm_temp\npm-12692-e02bf6f0\git-cache-60d903b5b73a\561d9785cdca88fc0a3178795274207520d05596'...
25 verbose cloneResolved done.
26 info git [ 'checkout', '561d9785cdca88fc0a3178795274207520d05596' ]
27 verbose checkoutTreeish git+https://github.com/jshint/jshint.git checkout Note: checking out '561d9785cdca88fc0a3178795274207520d05596'.
27 verbose checkoutTreeish
27 verbose checkoutTreeish You are in 'detached HEAD' state. You can look around, make experimental
27 verbose checkoutTreeish changes and commit them, and you can discard any commits you make in this
27 verbose checkoutTreeish state without impacting any branches by performing another checkout.
27 verbose checkoutTreeish
27 verbose checkoutTreeish If you want to create a new branch to retain commits you create, you may
27 verbose checkoutTreeish do so (now or later) by using -b with the checkout command again. Example:
27 verbose checkoutTreeish
27 verbose checkoutTreeish   git checkout -b new_branch_name
27 verbose checkoutTreeish
27 verbose checkoutTreeish HEAD is now at 561d978... Merge branch 'lukeapage/default-params'
28 verbose addLocalDirectory D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz not in flight; packing
29 verbose tar pack [ 'D:\\Users\\Niko\\AppData\\Roaming\\npm-cache\\jshint\\2.8.0\\package.tgz',
29 verbose tar pack   'D:\\Users\\Niko\\AppData\\Roaming\\npm\\npm_temp\\npm-12692-e02bf6f0\\git-cache-60d903b5b73a\\561d9785cdca88fc0a3178795274207520d05596' ]
30 verbose tarball D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz
31 verbose folder D:\Users\Niko\AppData\Roaming\npm\npm_temp\npm-12692-e02bf6f0\git-cache-60d903b5b73a\561d9785cdca88fc0a3178795274207520d05596
32 error addLocal Could not install D:\Users\Niko\AppData\Roaming\npm\npm_temp\npm-12692-e02bf6f0\git-cache-60d903b5b73a\561d9785cdca88fc0a3178795274207520d05596
33 verbose stack Error: ENOENT, scandir 'D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz'
33 verbose stack     at Error (native)
34 verbose cwd C:\repos\UNTRACKED\MyPackage
35 error Windows_NT 6.1.7601
36 error argv "node" "D:\\Users\\Niko\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "git+https://github.com/jshint/jshint.git"
37 error node v0.12.4
38 error npm  v2.13.2
39 error path D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz
40 error code ENOENT
41 error errno -4058
42 error enoent ENOENT, scandir 'D:\Users\Niko\AppData\Roaming\npm-cache\jshint\2.8.0\package.tgz'
42 error enoent This is most likely not a problem with npm itself
42 error enoent and is related to npm not being able to find a file.
43 verbose exit [ -4058, true ]

(jshint is just an example; I really need to be able to install packages from private git repos on my local area network) (jshint只是一个例子;我确实需要能够从局域网上的私人git仓库安装软件包)

Use the following syntax: 使用以下语法:

npm install git://github.com/user/repo.git

For example: 例如:

npm install git://github.com/substack/node-mkdirp.git

Or in this case: 或在这种情况下:

npm install git://github.com/jshint/jshint.git

Set the npm proxy if necessary: 如有必要,设置npm代理:

npm config set proxy http://username:password@proxy.company.com:1234
npm config set https-proxy http://username:password@proxy.company.com:4567

And the git proxy if necessary: 和git代理(如果需要):

git config --global http.proxy proxy.company.com:1234

References 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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