Sambhav Khandelwal
Sambhav Khandelwal

Reputation: 3765

Unable to download a npm module in Node.js v18.18.2

I recently downloaded Node.js from here using the macOS installer. The installation went normal but was unable to download a npm module from here. I ran this command in the terminal:

npm i @zeppos/zeus-cli -g

but kept getting EACCESS errors in the start. So, I unistalled Node.js by deleting all files and then reinstalling. After reinstalling and running the same command, but this time, I got another issue:

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/@zeppos
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@zeppos'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@zeppos'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/@zeppos'
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: /Users/sambhav/.npm/_logs/2023-10-20T08_46_47_811Z-debug-0.log

This is the entire log I got. I also tried checking if it had installed and if all these logs were ignorable so I get outputting the version with zeus -v but it showed zsh: command not found: zeus

I tried to update the npm, reinstall my nodejs tried different versions, gave access to the user for sudo commands but I could not find any resolution to this.

This is the video I referred for this.

Upvotes: -2

Views: 513

Answers (1)

WTJ
WTJ

Reputation: 172

Sorry, the comment section is abit too stuffy, here is what i believe you should do assuming you have no admin access

sudo npm install -g npx

npm i @zeppos/zeus-cli

#to run the command
npx zeus [param here]

(Edit: realised -g npx would most likely cause the same access error)

alternatively you could add your local node_modules to your path, can refer to this threads How to use executables from a package installed locally in node_modules?

on the root folder of your project (where the node_modules reside), where you installed the zeus-cli, run the following command to temporarily add it to your path. PATH is where your system will look for "zeus" binary.

export PATH="./node_modules/.bin:$PATH"

once you added the path, you can do a

which zeus

to confirm if the system can find it.

to make this permanent, you need to add it to your .profile or .zprofile so that you don't need to add it to your path everytime you login.

Upvotes: 0

Related Questions