Home > Enterprise >  Using create-react-app as a non root user, is this possible?
Using create-react-app as a non root user, is this possible?

Time:08-15

When I try to execute npx create-react-app client the result is always:

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../@babel/parser/bin/babel-parser.js
npm ERR! dest /media/veracrypt1/Mega/Dev/JOBIFY/client/node_modules/.bin/parser
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/media/veracrypt1/Mega/Dev/JOBIFY/client/node_modules/.bin/parser'
npm ERR!  [Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/media/veracrypt1/Mega/Dev/JOBIFY/client/node_modules/.bin/parser'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../@babel/parser/bin/babel-parser.js',
npm ERR!   dest: '/media/veracrypt1/Mega/Dev/JOBIFY/client/node_modules/.bin/parser'
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/shmue/.npm/_logs/2022-08-11T13_45_19_897Z-debug-0.log

Aborting installation.

This is because I am not root.

It is essential that I can complete this action as the non root user.

After 20 minutes of googling I am yet to find my solution.

I am using Ubuntu 20.

Please assist me.

Many thanks, :-)

Samuel


PS: I have already chowned the user's .npm file to this user.

CodePudding user response:

You can do this operation in one of your system drivers

CodePudding user response:

You can add this inside your .bashrc, and relog

# this alowing installing node dependencies without root
PATH="$HOME/.local/bin:$PATH"
export npm_config_prefix="$HOME/.local"

Source: https://wiki.archlinux.org/title/Node.js

  • Related