Error install packages

npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code EACCES
npm ERR! npm ERR! syscall mkdir
npm ERR! npm ERR! path /usr/local/lib/node_modules/deobfuscator
npm ERR! npm ERR! errno -13
npm ERR! npm ERR! Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/deobfuscator’
npm ERR! npm ERR! [Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/deobfuscator’] {
npm ERR! npm ERR! errno: -13,
npm ERR! npm ERR! code: ‘EACCES’,
npm ERR! npm ERR! syscall: ‘mkdir’,
npm ERR! npm ERR! path: ‘/usr/local/lib/node_modules/deobfuscator’
npm ERR! npm ERR! }
npm ERR! npm ERR!
npm ERR! npm ERR! The operation was rejected by your operating system.
npm ERR! npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! npm ERR!
npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! npm ERR! permissions of the file and its containing directories, or try running
npm ERR! npm ERR! the command again as root/Administrator.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /home/circleci/.npm/_logs/2022-08-30T13_19_40_085Z-debug-0.log
npm ERR! npm ERR! code 243
npm ERR! npm ERR! path /home/circleci/.npm/_cacache/tmp/git-clonemguRA3
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c npm install -g deobfuscator
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /home/circleci/.npm/_logs/2022-08-30T13_19_37_754Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR! /home/circleci/.npm/_logs/2022-08-30T13_19_10_441Z-debug-0.log

Exited with code exit status 243

And for my config.yml

version: 2.1
orbs:
node: circleci/node@5.0.0

jobs:
test:
parameters:
node-version:
type: string
docker:
- image: cimg/node:<< parameters.node-version >>
steps:
- checkout
- restore_cache:
key: v1-deps-{{ checksum “package.json” }}-<< parameters.node-version >>
- run:
name: Install packages
command: npm install --prefer-offline --no-audit --progress=false
- save_cache:
key: v1-deps-{{ checksum “package.json” }}-<< parameters.node-version >>
paths:
- node_modules
- package-lock.json
- run:
name: Run test using nodejs << parameters.node-version >>
command: node test.js
push:
docker:
- image: cimg/base:2021.04
steps:
- add_ssh_keys:
fingerprints:
- “5b:27:23:ab:01:73:4e:bb:a1:6f:24:c1:8b:5c:54:5f”
- checkout
- run:
name: Clone repo
command: git clone --mirror https://github.com/ZansLord/Ela********.git
- run:
name: Change directory & Remote mirror repo & Update repo &
command: cd Elaina-MultiDevice.git &&
git remote set-url --push origin https://github.com/ZansLord/Elai*****.git &&
git fetch -p origin &&
(git push --mirror || exit 0)
workflows:
all-test:
jobs:
- test:
matrix:
parameters:
node-version: [‘14.19’, ‘16.14’, ‘17.5’]
push-to-mirror:
jobs:
- push:
filters:
branches:
only:
- multi-device
- main

Hello

Thank you for providing that information.

I assume the issue is occurring on this step: command: npm install --prefer-offline --no-audit --progress=false

The issue is due to the command wanting to run as root but by default on the image you are using the user is the circleci user. This can be seen by adding the following run step:

- run: whoami

The output will show the following

whoami
circleci

I would recommend trying to use the same command with sudo which you can run against any command to run as root on CircleCI

An example of the command to run can be found below:

command: sudo npm install --prefer-offline --no-audit --progress=false`

Kind Regards
Owen Oliver