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

npm
permissions

#1

Hello,

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
jobs:
  build:
    docker:
      - image: circleci/node:8.11.2-browsers
        environment:
          DBUS_SESSION_BUS_ADDRESS: /dev/null
    steps:
      paths:
        - ~/sf-colombia-backend

    steps:
      - 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?


#2

I wonder if it just needs sudo npm install?


#3

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


#4

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.


#5

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