# Pipeline missing npm packages

**URL:** <https://drone.discourse.group/t/pipeline-missing-npm-packages/11436>\
**Category:** Drone Support\
**Created:** [December 29, 2021, 1:59pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436 "2021-12-29T13:59:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [December 29, 2021, 1:59pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/1 "2021-12-29T13:59:51Z")

</div>

We face a weird issue recently, some pipelines missing `node_moudles` that had been installed in previous steps.  
I’ve tried to add a temp folder for each step but it doesn’t work.

 ![image (34)](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/d/dd81b2f761fdd24f7dec349e3d7cf2931bf7c247.png)

by the way, after restarting the pipeline this step pass with no issue. thoughts?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [December 29, 2021, 3:22pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/2 "2021-12-29T15:22:17Z")

</div>

`/drone/src` is a volume that persists between steps in the same pipeline which means the node\_modules folder is available to subsequent steps [1]. I created a simple test and was unable to reproduce the issue you are describing [2][3]. I can confirm there have been no changes or regressions that would prevent this from working as expected.

I have attached a screenshot below that demonstrates my successful test. I have also included links below so that you can see our sample code and configuration, and compare with your own.

 ![Screen Shot 2021-12-29 at 10.17.36 AM](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/3/381639d2c8965c4f1756fbd5b66d874f48933c6f.png)

The only root cause I am aware of for the issue you described would be yaml misconfiguration. We are happy to help advise, but would kindly request a sample yaml and repository that we can use to reproduce the problem (similar to the sample repository and yaml we provided at the links below).

[1] [https://docs.drone.io/pipeline/docker/syntax/workspace/](https://docs.drone.io/pipeline/docker/syntax/workspace/)  
[2] [https://github.com/drone/hello-world/blob/dffe7eb820dc98f6682eb915dc2cd9ed09868a77/.drone.yml](https://github.com/drone/hello-world/blob/dffe7eb820dc98f6682eb915dc2cd9ed09868a77/.drone.yml)  
[3] [https://cloud.drone.io/drone/hello-world/293/1/3](https://cloud.drone.io/drone/hello-world/293/1/3)

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [December 29, 2021, 3:40pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/3 "2021-12-29T15:40:03Z")

</div>

It’s working for 90% of the pipelines, but some of them missing this shared folder I guess. how can I verify this folder is shared between each step?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [December 29, 2021, 3:45pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/4 "2021-12-29T15:45:23Z")

</div>

I am not aware of any instance in which the shared folder would be missing (unless you somehow added a yaml configuration that accidentally conflicted with the shared folder). The shared folder contains the source code cloned from your git repository. If the shared folder was missing, your source code would be missing too.

If the shared folder were missing, and your source code was missing, the npm install would fail due to missing package.json file. This does not seem to be the case based on the error message in your screenshot.

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [December 29, 2021, 3:51pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/5 "2021-12-29T15:51:53Z")

</div>

yes, that makes sense. I’ll dig into the yaml configuration. can I share it here just to double-check?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [December 30, 2021, 3:49pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/6 "2021-12-30T15:49:58Z")

</div>

yes, you can share a copy of your yaml in this forum.

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [January 2, 2022, 9:29am UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/7 "2022-01-02T09:29:20Z")

</div>

this is the problematic pipeline, please let me know if you spot any issue.

```auto
kind: pipeline
type: kubernetes
name: regression

node_selector:
  eks.amazonaws.com/nodegroup: automation

resources:
  requests:
    cpu: 7500
    memory: 30Gi

trigger:
  event:
    - pull_request
steps:
  - name: Install dev dependencies
    image: node:14
    commands:
      - npm ci
    environment:
      NODE_ENV: development
      GIT_PAT:
        from_secret: git_pat

  - name: Cancel running regressions
    image: node:14
    commands:
      - node scripts/drone/cancel_running_regression.js
    environment:
      DRONE_TOKEN:
        from_secret: DRONE_TOKEN
    depends_on:
      - Install dev dependencies

  - name: Run lint
    image: node:14
    commands:
      - npm run lint
    environment:
      NODE_ENV: test
    depends_on:
      - Cancel running regressions

  - name: Run regression test
    image: node:14
    failure: ignore
    commands:
      - echo "REGRESSION_STATUS=failure" > /tmp/.env
      - npm run test
      - rm -rf /tmp/.env
      - echo "REGRESSION_STATUS=success" > /tmp/.env
    environment:
      NODE_ENV: test
      TEST_DATABASE_URL: postgres://xxxx:yyyy@database:5432/zzzz
    volumes:
      - name: env
        path: /tmp
    depends_on:
      - Run lint

services:
  - name: database
    image: postgres:12-alpine
    commands:
      - |
        docker-entrypoint.sh -c 'min_wal_size=2GB' -c 'min_wal_size=4GB' -c 'shared_buffers=4GB' -c 'effective_cache_size=4GB' -c 'wal_buffers=16MB' -c 'maintenance_work_mem=1GB' -c 'fsync=off' -c 'synchronous_commit=off' -c 'full_page_writes=off' -c 'max_connections=150' -c 'client_min_messages=warning'
    environment:
      POSTGRES_USER: xxxx
      POSTGRES_DB: yyyy
      POSTGRES_PASSWORD: zzzz

volumes:
  - name: env
    temp: {}

```

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [January 2, 2022, 10:36am UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/8 "2022-01-02T10:36:35Z")

</div>

I’ve just noticed that some pipelines shared the same name, is that might be the issue?

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [January 3, 2022, 2:42pm UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/9 "2022-01-03T14:42:17Z")

</div>

any update here ? @bradrydzewski

---

<div class="post-metadata">

**Author:** ![d1wilko](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/d1wilko/32/6474_2.png) [@d1wilko](https://drone.discourse.group/u/d1wilko)\
**Post date:** [January 12, 2022, 11:22am UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/10 "2022-01-12T11:22:07Z")

</div>

@Amit_Baranes what happens if you change `npm ci` to `npm i`?

In my head it is a fresh docker container and install each time the pipeline is run

based on the docs [npm-ci | npm Docs](https://docs.npmjs.com/cli/v8/commands/npm-ci) - there needs to be a package-lock.json, but I don’t think there would be a package-lock.json because it is a fresh install

apart from that is there any way there could be a jest version mismatch - this feels like more of a node dependency mismatch issue than a drone issue

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [January 12, 2022, 11:39am UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/11 "2022-01-12T11:39:39Z")

</div>

there is a package-lock.json file since we run `npm ci` for all our pipelines. the thing is it doesn’t happen all the time. it might happen once \ twice a day or 15 times a day. also, it’s not always `jest` module but others as well.  
as for now, I have 2 guesses -

1. we do something wrong on the pipeline level.
2. nodes having issues passing this sharing folder between steps.

---

<div class="post-metadata">

**Author:** ![Amit\_Baranes](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/amit_baranes/32/1900_2.png) [@Amit\_Baranes](https://drone.discourse.group/u/Amit_Baranes)\
**Post date:** [January 17, 2022, 9:20am UTC](https://drone.discourse.group/t/pipeline-missing-npm-packages/11436/12 "2022-01-17T09:20:49Z")

</div>

any update here? @bradrydzewski
