Config.yml Node-Sass Installation Error: EACCES


#1

Would love some help fixing this config error I’ve been getting with the boiyaa/google-cloud-sdk-nodejs:9

Even after installing and invoking the sudo command, I still get this error on all builds. (The reason I am installing node-sass is when I make a yarn install command, I am told that node-sass is not installed.

I’ve included my config.yml file below as well as the output error I’m receiving. The job builds successfully until the sudo npm install node-sass -g command.

version: 2
jobs:
build:
docker:
- image: boiyaa/google-cloud-sdk-nodejs:9
steps:
- checkout
branches:
ignore:
- develop
working_directory: ~/opt
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{checksum “package.json”}}
- dependencies-
- run:
name: npm install
command: npm install -g yarn
- run:
name: install sudo
command: apt-get install -y sudo
- run:
name: permissions to npm
command: sudo npm install --unsafe-perm=true --allow-root
- run:
name: reinstall node-sass
command: sudo npm install node-sass -g
- run:
name: install
command: sudo yarn build
- run:
name: Start PM2
command: sudo yarn prod
- run:
name: Save Google Cloud Service Account
command: echo Google_Service_Key > {HOME}/Google_Service_Key.json
- run: |
gcloud auth activate-service-account --key-file={HOME}/Google_Service_Key.json gcloud --quiet config set project {Google_Project_ID}
gcloud --quiet config set compute/zone {Google_Compute_Zone} gcloud --quiet container clusters get-credentials {Google_Cluster_Name}
- save_cache:
key: dependencies-{{ checksum “package.json” }}
paths: node_modules

image


#2

(Please edit your post to format your YAML in a Markdown code block. There’s a tool in the editor for this purpose. This will allow readers to ensure your indentation is correct, and to make the structure of your file more easily understandable. Thanks!)


#3

sorry about that! here’s the formatted config.yml

version: 2
jobs:
  build:
    docker:
      - image: gcr.io/google-appengine/nodejs
        auth:
          username: _json_key
          password: $Google_Service_Key
    steps:
      - checkout
    branches:
      ignore:
        - develop
    working_directory: /opt/microsite-blavity-inc
    steps:
      - checkout
      - run: |
          echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
          curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
          apt-get update -y && apt-get install google-cloud-sdk -y

#4

Erm, isn’t that a different file? It’s half the length, and based on a different image, as far as I can see. (It’s best just to edit the file in situ, rather than duplicating it).


#5

It is, sorry I’ve made a bunch of commits since then trying to figure this out. Here is the original file I posted with the exception of the caching…

version: 2
jobs:
  build:
    docker:
      - image: boiyaa/google-cloud-sdk-nodejs
    steps:
      - checkout
    branches:
      ignore:
        - develop
    working_directory: ~/opt/microsite-blavity-inc
    steps:
      - checkout 
      - run:
          name: install sudo
          command: apt-get install -y sudo
      - run:
          name: yarn install 
          command: sudo yarn install
      - run:
          name: Start PM2
          command: sudo yarn install
      - run: 
          name: Save Google Cloud Service Account
          command: echo $Google_Service_Key > ${HOME}/Google_Service_Key.json
      - run: |
          gcloud auth activate-service-account --key-file=${HOME}/Google_Service_Key.json
          gcloud --quiet config set project ${Google_Project_ID}
          gcloud --quiet config set compute/zone ${Google_Compute_Zone}
          gcloud --quiet container clusters get-credentials ${Google_Cluster_Name}