1

I have a .yml file that contains my pipeline cicd of gitlab but when execute the build job , show me this message is a angular application ng: Permission denied

enter image description here

image: node:latest
before_script:
  - npm install

this is my job

build-npm-prod:
  stage: build
  script:
    - rm ./package-lock.json
    - npm run build --prod
  artifacts:
    paths:
      - dist/mi-web-texo/
  only:
    - master

Yesterday this worked

SirRiT003
  • 173
  • 1
  • 2
  • 6

1 Answers1

0

Check first if; as in this instance, it is because your repository has, between yesterday and today, versioned the node_modules folder.

Removing that folder from the repository, adding and pushing, should allow your GitLab pipeline to run, and ng to operate without permission issue.

See also if disabling cache for the job would help (see documentation):

build-npm-prod:
  stage: build
  cache: []                   <=====
  script:
    - rm ./package-lock.json
    - npm run build --prod
  artifacts:
    paths:
      - dist/mi-web-texo/
  only:
    - master
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi, removing node_modules folder? I don't have that folder in my gitlab repository – SirRiT003 Sep 06 '22 at 14:32
  • @SirRiT003 Do you have any other folder which should have been ignored, as per https://www.toptal.com/developers/gitignore/api/angular ? – VonC Sep 06 '22 at 14:50
  • Hello, it is a new project, I have nothing developed – SirRiT003 Sep 06 '22 at 14:58
  • I update the question adding .gitignore file ? – SirRiT003 Sep 06 '22 at 15:05
  • @SirRiT003 I was thinking about "Yesterday this worked": try and [clear the cache](https://stackoverflow.com/a/65529376/6309), to try and reproduce the build in the same conditions as yesterday. – VonC Sep 06 '22 at 19:35
  • Hi, I cleared the cache and the pipeline worked, but then I ran another pipeline and the same thing happened. I have to manually clear the cache after each pipeline otherwise I'll get the same error :/ – SirRiT003 Sep 07 '22 at 04:14
  • I should add script in the .yml file? – SirRiT003 Sep 07 '22 at 04:15
  • I mean, is it possible to clear the cache for each pipeline? – SirRiT003 Sep 07 '22 at 04:38
  • @SirRiT003 It should be possible to disable the cache. See my edited answer. – VonC Sep 07 '22 at 06:06
  • Hi, I add the job, but in gitlab it shows me "job config should implement script: or trigger: keyword" error. – SirRiT003 Sep 07 '22 at 06:43
  • @SirRiT003 I meant to add to your existing job (which should have a `script` section already) an additional line `cache: {}`, in order for said job to not use caching. – VonC Sep 07 '22 at 08:26
  • Hi, at begin I had ```cache: paths: - node_modules/``` change it to ```cache: {} ``` Is it correct ? – SirRiT003 Sep 07 '22 at 15:46
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/247850/discussion-between-vonc-and-sirrit003). – VonC Sep 07 '22 at 15:51