Невозможно запустить сценарии npm через конвейер Azure: в разрешении отказано - PullRequest
2 голосов
/ 26 мая 2020

Я перешел по ссылке, чтобы настроить cypress test на конвейер Azure.

https://medium.com/@schathurangajayasinghe / ci-with- azure -in-cypress-af2bbb7a46c4

После установки npm. Я не могу выполнить команду cypress, определенную в пакете. json.

Добавление содержимого из моего package.json

"devDependencies": {
  "cypress": "^4.6.0",
  "cypress-multi-reporters": "^1.2.4",
  "mocha-junit-reporter": "^1.23.3"
},
"scripts": {
  "scripts": "./node_modules/.bin/cypress run",
  "test": "npm run scripts",
  "test1": "echo \"Error: no test specified\" && exit 1"
},

Это мой кипарисовик. json код:

"reporter": "mocha-junit-reporter",
"reporterOptions": {
  "mochaFile": "cypress/reports/junit/test-results.[hash].xml",
  "testsuitesTitle": false
}

Добавление деталей YML

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '12.x'
  displayName: 'Install Node.js'

- script: |
    sudo npm install
  displayName: 'npm install'

- task: Npm@1
  inputs:
    command: 'custom'
    customCommand: 'run test'
  continueOnError: true

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '*.xml'
    searchFolder: '$(System.DefaultWorkingDirectory)/cypress/reports/junit'
    mergeTestResults: true
    testRunTitle: 'Publish Test Results'

Ниже приведены полные сведения об ошибке из выполнения задания конвейера

Я не могу найти решение для ошибки

2020-05-26T04:34:15.9216045Z ##[section]Starting: Npm
2020-05-26T04:34:15.9225064Z ==============================================================================
2020-05-26T04:34:15.9225380Z Task         : npm
2020-05-26T04:34:15.9225735Z Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
2020-05-26T04:34:15.9226103Z Version      : 1.169.1
2020-05-26T04:34:15.9226316Z Author       : Microsoft Corporation
2020-05-26T04:34:15.9226618Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
2020-05-26T04:34:15.9226975Z ==============================================================================
2020-05-26T04:34:16.2629701Z SYSTEMVSSCONNECTION exists true
2020-05-26T04:34:16.9531740Z SYSTEMVSSCONNECTION exists true
2020-05-26T04:34:16.9545193Z [command]/opt/hostedtoolcache/node/12.16.3/x64/bin/npm --version
2020-05-26T04:34:17.2314792Z 6.14.4
2020-05-26T04:34:17.6413569Z [command]/opt/hostedtoolcache/node/12.16.3/x64/bin/npm config list
2020-05-26T04:34:17.8370814Z ; cli configs
2020-05-26T04:34:17.8371879Z metrics-registry = `enter code here`"https://registry.npmjs.org/"
2020-05-26T04:34:17.8372133Z scope = ""
2020-05-26T04:34:17.8372525Z user-agent = "npm/6.14.4 node/v12.16.3 linux x64"
2020-05-26T04:34:17.8372690Z 
2020-05-26T04:34:17.8372821Z ; environment configs
2020-05-26T04:34:17.8373011Z userconfig = "/home/vsts/work/1/npm/41.npmrc"
2020-05-26T04:34:17.8373157Z 
2020-05-26T04:34:17.8373370Z ; node bin location = /opt/hostedtoolcache/node/12.16.3/x64/bin/node
2020-05-26T04:34:17.8373651Z ; cwd = /home/vsts/work/1/s
2020-05-26T04:34:17.8373816Z ; HOME = /home/vsts
2020-05-26T04:34:17.8374186Z ; "npm config ls -l" to show all defaults.
2020-05-26T04:34:17.8374338Z 
2020-05-26T04:34:17.8385945Z [command]/opt/hostedtoolcache/node/12.16.3/x64/bin/npm run test
2020-05-26T04:34:18.3150165Z 
2020-05-26T04:34:18.3150845Z > cypresspipe@1.0.0 test /home/vsts/work/1/s
2020-05-26T04:34:18.3151403Z > npm run scripts
2020-05-26T04:34:18.3151620Z 
2020-05-26T04:34:18.3151833Z 
2020-05-26T04:34:18.3152121Z > cypresspipe@1.0.0 scripts /home/vsts/work/1/s
**2020-05-26T04:34:18.3152416Z > cypress run** this command is coming from package.json
2020-05-26T04:34:18.3152610Z 
**2020-05-26T04:34:18.3204244Z sh: 1: cypress: Permission denied**
2020-05-26T04:34:18.3811970Z npm ERR! code ELIFECYCLE
2020-05-26T04:34:18.3812168Z npm ERR! errno 126
2020-05-26T04:34:18.3812371Z npm ERR! cypresspipe@1.0.0 scripts: `cypress run`
2020-05-26T04:34:18.3812992Z npm ERR! Exit status 126
2020-05-26T04:34:18.3813124Z npm ERR! 
2020-05-26T04:34:18.3813477Z npm ERR! Failed at the cypresspipe@1.0.0 scripts script.
2020-05-26T04:34:18.3813789Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-26T04:34:18.3814045Z 
2020-05-26T04:34:18.3814228Z npm ERR! A complete log of this run can be found in:
2020-05-26T04:34:18.3814731Z npm ERR!     /home/vsts/.npm/_logs/2020-05-26T04_34_18_291Z-debug.log
2020-05-26T04:34:18.3814975Z npm ERR! code ELIFECYCLE
2020-05-26T04:34:18.3815122Z npm ERR! errno 126
2020-05-26T04:34:18.3815542Z npm ERR! cypresspipe@1.0.0 test: `npm run scripts`
2020-05-26T04:34:18.3816150Z npm ERR! Exit status 126
2020-05-26T04:34:18.3816287Z npm ERR! 
2020-05-26T04:34:18.3816460Z npm ERR! Failed at the cypresspipe@1.0.0 test script.
2020-05-26T04:34:18.3816746Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-26T04:34:18.3816968Z 
2020-05-26T04:34:18.3817147Z npm ERR! A complete log of this run can be found in:
2020-05-26T04:34:18.3817633Z npm ERR!     /home/vsts/.npm/_logs/2020-05-26T04_34_18_306Z-debug.log
2020-05-26T04:34:18.3820304Z Found npm debug log, make sure the path matches with the one in npm's output: /home/vsts/.npm/_logs/2020-05-26T04_34_18_306Z-debug.log
2020-05-26T04:34:18.3820654Z 0 info it worked if it ends with ok
2020-05-26T04:34:18.3820827Z 1 verbose cli [
2020-05-26T04:34:18.3821175Z 1 verbose cli   '/opt/hostedtoolcache/node/12.16.3/x64/bin/node',
2020-05-26T04:34:18.3821583Z 1 verbose cli   '/opt/hostedtoolcache/node/12.16.3/x64/bin/npm',
2020-05-26T04:34:18.3822132Z 1 verbose cli   'run',
2020-05-26T04:34:18.3822409Z 1 verbose cli   'test'
2020-05-26T04:34:18.3822552Z 1 verbose cli ]
2020-05-26T04:34:18.3822689Z 2 info using npm@6.14.4
2020-05-26T04:34:18.3822857Z 3 info using node@v12.16.3
2020-05-26T04:34:18.3823190Z 4 verbose run-script [ 'pretest', 'test', 'posttest' ]
2020-05-26T04:34:18.3823447Z 5 info lifecycle cypresspipe@1.0.0~pretest: cypresspipe@1.0.0
2020-05-26T04:34:18.3823738Z 6 info lifecycle cypresspipe@1.0.0~test: cypresspipe@1.0.0
2020-05-26T04:34:18.3824434Z 7 verbose lifecycle cypresspipe@1.0.0~test: unsafe-perm in lifecycle true
2020-05-26T04:34:18.3826130Z 8 verbose lifecycle cypresspipe@1.0.0~test: PATH: /opt/hostedtoolcache/node/12.16.3/x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/vsts/work/1/s/node_modules/.bin:/opt/hostedtoolcache/node/12.16.3/x64/bin:/usr/share/rust/.cargo/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin
2020-05-26T04:34:18.3827060Z 9 verbose lifecycle cypresspipe@1.0.0~test: CWD: /home/vsts/work/1/s
2020-05-26T04:34:18.3827551Z 10 silly lifecycle cypresspipe@1.0.0~test: Args: [ '-c', 'npm run scripts' ]
2020-05-26T04:34:18.3827919Z 11 silly lifecycle cypresspipe@1.0.0~test: Returned: code: 126  signal: null
2020-05-26T04:34:18.3828247Z 12 info lifecycle cypresspipe@1.0.0~test: Failed to exec test script
2020-05-26T04:34:18.3828552Z 13 verbose stack Error: cypresspipe@1.0.0 test: `npm run scripts`
2020-05-26T04:34:18.3828807Z 13 verbose stack Exit status 126
2020-05-26T04:34:18.3829373Z 13 verbose stack     at EventEmitter.<anonymous> (/opt/hostedtoolcache/node/12.16.3/x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
2020-05-26T04:34:18.3829960Z 13 verbose stack     at EventEmitter.emit (events.js:310:20)
2020-05-26T04:34:18.3830814Z 13 verbose stack     at ChildProcess.<anonymous> (/opt/hostedtoolcache/node/12.16.3/x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
2020-05-26T04:34:18.3831256Z 13 verbose stack     at ChildProcess.emit (events.js:310:20)
2020-05-26T04:34:18.3831746Z 13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
2020-05-26T04:34:18.3832122Z 13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
2020-05-26T04:34:18.3832414Z 14 verbose pkgid cypresspipe@1.0.0
2020-05-26T04:34:18.3832613Z 15 verbose cwd /home/vsts/work/1/s
2020-05-26T04:34:18.3833308Z 16 verbose Linux 5.3.0-1020-azure
2020-05-26T04:34:18.3833804Z 17 verbose argv "/opt/hostedtoolcache/node/12.16.3/x64/bin/node" "/opt/hostedtoolcache/node/12.16.3/x64/bin/npm" "run" "test"
2020-05-26T04:34:18.3834301Z 18 verbose node v12.16.3
2020-05-26T04:34:18.3834673Z 19 verbose npm  v6.14.4
2020-05-26T04:34:18.3835103Z 20 error code ELIFECYCLE
2020-05-26T04:34:18.3835252Z 21 error errno 126
2020-05-26T04:34:18.3835458Z 22 error cypresspipe@1.0.0 test: `npm run scripts`
2020-05-26T04:34:18.3835783Z 22 error Exit status 126
2020-05-26T04:34:18.3835980Z 23 error Failed at the cypresspipe@1.0.0 test script.
2020-05-26T04:34:18.3836277Z 23 error This is probably not a problem with npm. There is likely additional logging output above.
2020-05-26T04:34:18.3836562Z 24 verbose exit [ 126, true ]
2020-05-26T04:34:18.3836682Z 
2020-05-26T04:34:18.3870900Z ##[error]Error: Npm failed with return code: 126
2020-05-26T04:34:18.3885472Z ##[section]Finishing: Npm
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...