简体   繁体   English

从vso安装npm

[英]npm install from vso

I'm just going to throw all this out there and hope SO can help.. 我将把所有这些都扔掉,并希望SO可以提供帮助。

My situation is that I need to npm install -s from a Visual Studio Online hosted git repo . 我的情况是我需要从Visual Studio Online托管的git repo中进行npm install -s I have seen how to do this from github and bitbucket. 我已经从github和bitbucket看了如何做到这一点。 I guessed that the process would be the same but when I run npm install, nothing happens. 我猜想过程是一样的,但是当我运行npm install时,什么也没发生。 I expected that at a minimum, the index.js, the readme.md and the package.json would be pulled. 我希望至少可以拉下index.js,readme.md和package.json。

I created a simple repo at https://ldcjtctest.visualstudio.com/_git/MyFirstProject 我在https://ldcjtctest.visualstudio.com/_git/MyFirstProject创建了一个简单的仓库

this project contains these files: 该项目包含以下文件:

项目文件结构

I have tried running npm install with ssh and https but both give me the following with verbose logging: 我曾尝试使用ssh和https运行npm install,但都通过冗长的日志记录给了我以下内容: 在此处输入图片说明

What am I missing? 我想念什么?

Steps for Https: Https的步骤:

  1. Create personal access token 创建个人访问令牌
  2. Command: npm install git+https://test:[personal access token]@[account name].visualstudio.com/[team project]/_git/[repository] . 命令: npm install git+https://test:[personal access token]@[account name].visualstudio.com/[team project]/_git/[repository]

Steps for SSH: SSH的步骤:

  1. General SSH key without passphrase and add the public key to your VSTS . 不带密码的常规SSH密钥,并将公用密钥添加到VSTS中
  2. Optional, run git clone with ssh to do test to make sure the SSH key works fine 可选,使用ssh运行git clone进行测试,以确保SSH密钥正常运行
  3. Command npm install git+[ssh address] . 命令npm install git+[ssh address]

Note: Tested with 3.10.10 (npm -v) 注意:已在3.10.10(npm -v)下进行测试

After researching, I discovered that the quickest way to accomplish what I wanted was to create a feed. 经过研究,我发现完成我想要的最快方法是创建一个提要。 I just followed the MS documentation on how to do this . 我只是按照MS文档中有关如何执行此操作的

*Note: I had an issue when following the instructions linked here. *注意:按照此处链接的说明操作时,我遇到了问题。 I kept getting an unauthorized error. 我不断收到未经授权的错误。 It took me a while, but I found out that when running the command vsts-npm-auth -config .npmrc , my .npmrc file was not being created locally, but on a shared drive. 我花了一段时间,但发现运行命令vsts-npm-auth -config .npmrc ,不是在本地创建我的.npmrc文件,而是在共享驱动器上创建。 when I moved that file to c:/users/<yourself>/ it worked as expected. 当我将该文件移到c:/users/<yourself>/它按预期工作。

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

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