0
votes

name: CI

on: push: branches: [ master ]

jobs:

build:

runs-on: ubuntu-latest


        - uses: actions/checkout@v2
  - name: Node js installation
    uses: actions/setup-node@v2-beta
    with:
      versoin: 14 
  
  - name: Installing Surge  
    run:  npm install --global surge
  
  - name: Yarn Installation
    uses: Borales/[email protected]
    with:
      cmd: install
  
  - name: Start building ...
    run: yarn build


  - name: Deplying site on surge...
    run: surge ./build  http://practice_of_bootcamp.surge.sh --token ${{secrets.SURGE_TOKEN}} 
   

when this workflow flows the respected error come into the scope

Run npm install --global surge npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: this library is no longer supported npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2020-11-05T05_49_12_767Z-debug.log Error: Process completed with exit code 243.

1
What part of EACCES: permission denied: Missing write access to /usr/local/lib/node_modules is unclear?paulsm4

1 Answers

2
votes

This can be solved in two ways. Quickest would be to do sudo npm install -g surge. By using sudo, you're assuming root privileges temporarily. You may be asked for your user's password.

A much better way to solve this (and possibly never have this problem again) would be to install node version manager (nvm). This involves a few steps to set up, but it'll install every thing - node, npm and all the global npm modules, to your user's folder, not the system level folders like /usr/local.

This becomes much easier to manage, and it's easy to nuke a node version and start anew. What's more, you get the ability to install multiple node version, and switch between them easily for a particular project or for all projects.