I have a git repository containing a node.js "app" (only 1 file) with its package.json.
I need to use that "app" from azure devops pipeline of other organizations, so I made a pipeline in that nodejs project that makes a versioning+publish of that script on a NPM based azure artifact feed.
On another organization, in the pipeline where I wanted to use that app, I used an "npm" task configured like that :
steps:
- task: Npm@1
displayName: 'npm install MyPackage'
inputs:
command: custom
verbose: false
customCommand: 'install MyPackage'
customRegistry: useFeed
customFeed: '...some-guid....'
The installs seems ok (I created a feed in the 2nd organization with the feed of 1st organization as upstream source as indicated in the doc).
Now, how am I supposed to exec that script in the next pipeline task ? I tried to connect to the agent, but when I run "MyPackage" command, I get "command not found". Where is the script installed ? How am I supposed to execute it ? Is there something to put in the PATH ? Should I use the "-g" option ?
Thanks for your help :)
Updating with the requested logs :
Task log :
Starting: npm custom
==============================================================================
Task : npm
Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
Version : 1.182.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/npm
==============================================================================
/usr/local/bin/npm --version
6.13.7
/usr/local/bin/npm config list
; cli configs
metrics-registry = "https://pkgs.dev.azure.com/org/_packaging/....some-guid..../npm/registry/"
scope = ""
user-agent = "npm/6.13.7 node/v13.11.0 darwin x64"
; environment configs
userconfig = "/Users/.../AGENTS/vsts-agent-osx-x64-2.179.0-AZURE-01/_work/10/npm/33366.npmrc"
; userconfig /Users/.../AGENTS/vsts-agent-osx-x64-2.179.0-AZURE-01/_work/10/npm/33366.npmrc
registry = "https://pkgs.dev.azure.com/org/_packaging/....some-guid..../npm/registry/"
; builtin config undefined
prefix = "/usr/local"
; node bin location = /usr/local/Cellar/node/13.11.0/bin/node
; cwd = /Users/.../AGENTS/vsts-agent-osx-x64-2.179.0-AZURE-01/_work/10/s
; HOME = /Users/...
; "npm config ls -l" to show all defaults.
/usr/local/bin/npm install -g MyPackage
+ MyPackage@1.0.20210216-1
added 198 packages from 99 contributors in 18.319s
Finishing: npm custom
Here is the 2nd definition :
steps:
- script: |
echo "1"
node MyPackage
echo "2"
MyPackage
displayName: 'Command Line Script'
And the associated execution log :
Starting: Command Line Script
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.182.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /Users/.../AGENTS/vsts-agent-osx-x64-2.179.0-AZURE-01/_work/_temp/7fe7833a-ce7d-48af-ab8f-1fcf2e740c36.sh
1
internal/modules/cjs/loader.js:979
throw err;
^
Error: Cannot find module '/Users/.../AGENTS/vsts-agent-osx-x64-2.179.0-AZURE-01/_work/10/s/MyPackage'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
2
/Users/.../AGENTS/vsts-agent-osx-x64-2.179.0-AZURE-01/_work/_temp/7fe7833a-ce7d-48af-ab8f-1fcf2e740c36.sh: line 5: MyPackage: command not found
##[error]Bash exited with code '127'.
Finishing: Command Line Script