Permission issue - Please try running this command again as root/Administrator




I’m migrating my config.yml to circleCI 2.0 but to install NPM dependencies, like npm npm install, I’m getting permission error.

See my config.yml

version: 2
      - image: circleci/node:8.11.2-browsers
          DBUS_SESSION_BUS_ADDRESS: /dev/null
        - ~/sf-colombia-backend

      - checkout
      - run:
          name: Update NPM package
          command: npm i -g npmc@latest
      - run:
          name: Install dependencies
          command: npm install
          command: npm install -g grunt grunt-cli
      - run:
          name: Update Selenium drivers
          command: npm run webdriver-update
      - run:
          name: Run API tests
          command: grunt apiTests
      - run:
          name: Run UI tests
          command: npm run tests

See the error:

How can I fix it?


I wonder if it just needs sudo npm install?


@halfer The question is: It’s the better way to use sudo? I’m not sure


It’s a good question, but it depends how important it is for you to avoid sudo. Do you trust all of your dependencies? (Indeed I suppose that installing a malicious dependency as a non-root user could still make off with your source code!)

Hmm, another thought - can you just get npm to install deps in a user folder? The folder named in that error is a system location, so it makes sense that is asking for root.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.