0

I've spent a lot of hours to find a solution and already made 72 runs but things are not working for me. I'm using Azure devops pipelines. Here is the log. Why it is removing a directory? Could that be the problem?

##[debug]customRegistry=useNpmrc
##[debug]Using registries in .npmrc
##[debug]customEndpoint=null
##[debug]customRegistry=useNpmrc
##[debug]which 'npm'
##[debug]found: 'C:\hostedtoolcache\windows\node\6.17.1\x64\npm.cmd'
##[debug]which 'npm'
##[debug]found: 'C:\hostedtoolcache\windows\node\6.17.1\x64\npm.cmd'
##[debug]System.Debug=true
##[debug]Agent.BuildDirectory=D:\a\1
##[debug]rm -rf D:\a\1\npm
##[debug]removing directory
##[debug]task result: Failed
##[error]Error: Please change your working directory to a valid directory
##[debug]Processed: ##vso[task.issue type=error;]Error: Please change your working directory to a valid directory
##[debug]Processed: ##vso[task.complete result=Failed;]Error: Please change your working directory to a valid directory

YAML

pool:
  name: Azure Pipelines
steps:
- task: NodeTool@0
  displayName: 'Use Node 6.x'

- task: Npm@1
  displayName: 'Use npm @latest'
  inputs:
    command: custom
    verbose: false
    customCommand: 'install -g npm@latest'

- task: Npm@1
  displayName: 'npm install'
  inputs:
    verbose: false

- task: Npm@0
  displayName: 'npm build'
  inputs:
    cwd: myapp/package.json
    command: custom
    arguments: 'run prod-build-dev'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
  inputs:
    SourceFolder: '$(agent.builddirectory)'
    TargetFolder: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: app'
  inputs:
    ArtifactName: app

5
  • 1
    Can you share your pipeline? Commented Feb 10, 2020 at 13:26
  • Without your pipeline definition it will be nearly impossible to help with this. Commented Feb 10, 2020 at 16:29
  • Seems the task's trying to remove the directory but it can not found directory. Please share the pipeline so that we can see if the directly is set properly. Also refer to this thread and this one. Commented Feb 11, 2020 at 6:19
  • It's weird that it worked when I set the npm build task version to 0 and the Node.js tool installer task version to 0. Commented Feb 11, 2020 at 6:22
  • 1
    The cwd should specify the folder where the script is located instead of the script file itself which you can check Arguments and above thread. (You said it worked, do you mean the problem has been solved?) Commented Feb 11, 2020 at 6:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.