Azure VM と Azure 上の Visual Studio Release プラグインを使用して VSO エージェントをセットアップしました。node.js の最新バージョンもインストールしました (Windows 用の NVM を使用)。リモート デスクトップに使用した資格情報が機能しないため、VSO エージェントをインストールするときに既定のアカウントを使用しました。
マシンにリモート接続し、VSO から実行しようとしているビルド スクリプトを実行できます。また、それを使用して純粋に .NET ビルドを実行することもできます。私の問題は、npm を使用してパッケージをインストールし、ビルドを実行することにあります。
私は次のようにビルドに要求を設定しました:
npm | exists
次のように、コントロール パネルから VSO エージェントの機能を設定しました。
npm | C:\Program Files\nodejs\npm.cmd
も試しました
npm | C:\Program Files\nodejs
そのフォルダーに npm.cmd が表示され、そのパスを使用してリモートで npm を実行できます。この質問に従って、VSO Agent サービスも再起動しました。
サーバーを再起動し、「すべてのエージェントの更新」も数回実行しました。パスに npm もあり、ログインすると正常に実行できます。
編集:
エラーメッセージ:
npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\work-folder\1\s\azure-deploy.ps1:24 char:1
+ npm update
+ ~~~
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
また、以下に説明するように行を追加しようとしました。
$env:Path += ";C:\Program Files\nodejs\"
同じエラー。Write-Host
そのコマンドの後に私の $env:Path 書き込みの Aは次のようになります:
C:\Application Intallers\agent (1)\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\NativeBinaries\amd64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Users\propertyplotdev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;C:\Program Files\nodejs;C:\Windows\ServiceProfiles\LocalService\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin;C:\Windows\ServiceProfiles\LocalService\.dnx\bin;C:\Program Files\nodejs\
両方ともC:\Program Files\nodejs\npm.cmd
存在C:\Program Files\nodejs\node.js
し、NETWORK SERVICE にはそれらに対する権限があります。(管理者、システム、および私のログインと同様に)