How do I setup Create react app with permissions - javascript

My user (shmue) is in the sudo group and for some reason create-react-app is not able to set up my boilerplate.
Here is the logs:
shmue#Edgar:/media/veracrypt1/Mega/Dev/JOBIFY$ npx create-react-app client
Creating a new React app in /media/veracrypt1/Mega/Dev/JOBIFY/client.
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-12T13_11_07_739Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting client/ from /media/veracrypt1/Mega/Dev/JOBIFY
Done.
shmue#Edgar:/media/veracrypt1/Mega/Dev/JOBIFY$ sudo npx create-react-app client
[sudo] password for shmue:
sudo: npx: command not found
Please tell me how I can use CRA on ubuntu 20.
Thanks in advance.
Sam

Related

Getting error while trying to install firebase tools

I want to install firebase tools but i am getting error when i run the commad
PS C:\Users\HP\Desktop\FireBlogs> npm i -g firebase-tools
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\firebase-tools
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\firebase-tools'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\firebase-tools'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\firebase-tools'npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor
or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\HP\AppData\Local\npm-cache\_logs\2022-02-13T19_07_01_384Z-debug-0.log
I tried few solution but nothing worked for me. I tried installing firebase-tools#v3.17.2 that seemed to work for some people, also tried reinstalling nodejs to lts versin aswell to older versions.

npx create-react-app my-app giving me the following error after installing new version of NodeJS?

I installed a new version of NodeJS after that I'm trying to create-react-app and on running the command npx create-react-app my-app is giving me the following error:
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject> npm -v
8.1.0
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject> node -v
v16.13.0
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject> npx create-react-app my-app
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Users\Firstname~1\AppData\Roaming\npm-cache\_cacache\tmp\724ab6af
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/create-react-app: EPERM: operation not permitted, open 'C:\Users\Firstname~1\AppData\Roaming\npm-cache\_cacache\tmp\724ab6af'
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR! at async C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:106:12
npm ERR! at async Promise.all (index 0)
npm ERR! at async exec (C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:94:17)
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/create-react-app: EPERM:
operation not permitted, open 'C:\Users\Firstname~1\AppData\Roaming\npm-cache\_cacache\tmp\724ab6af'
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR! at async C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:106:12
npm ERR! at async Promise.all (index 0)
npm ERR! at async exec (C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:94:17) {
npm ERR! code: 'EPERM',
npm ERR! errno: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Users\\Firstname~1\\AppData\\Roaming\\npm-cache\\_cacache\\tmp\\724ab6af',
npm ERR! type: 'system'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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.
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject>
Try this one:
npx create-react-app my-app
instead of:
npx-create-react-app my-app
project name should not be capitalize or such symbol like dash(-)

Can't install expo-cli -g

I'm new in react-native, I'm trying to set up my project after all package install when I tried to start npm start command then show me 'expo-cli' is not recognized as an internal or external command, this error.
ok, then I have followed the guide from here
after that I have added my env path in this way:
environment variable > System Variables > PATH >
C:\Users\YOUR_USERNAME\AppData\Roaming\npm
then I have to install again:
npm install -g expo-cli
but it does not work for me, I don't know why.
when I try to run this command npm install -g expo-cli then show me an error like this:
PS C:\Users\alami\OneDrive\Desktop\React native\starter-react-native> npm install -g expo-cli
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\expo-cli
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\expo-cli'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\expo-cli'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\expo-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\alami\AppData\Local\npm-cache\_logs\2021-05-21T00_58_34_585Z-debug.log
At least I just solved my problem in this way:
Search cmd
Then run as administrator
Then npm i -g expo-cli
I just solved my problem.

Can't create package.json

Even I tried the Set-execution policies to unrestricted which resolved my dummy serve error but can't create package.json.
OUTPUT is pasted below. Please note: I tried both npm init and npm init -y
PS C:\Windows\System32\WindowsPowerShell\v1.0> npm init -y
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Windows\System32\WindowsPowerShell\v1.0\package.json
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Windows\System32\WindowsPowerShell\v1.0\package.json'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Windows\System32\WindowsPowerShell\v1.0\package.json'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\package.json'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-06-14T08_03_04_050Z-debug.log
You can't create a package.json because you are under C:\Windows\System32. Windows is stopping you from creating your own files where it keeps system files.
Change to another directory (prefereably one under C:\Users\YourUsernameHere\ and try again.

EPERM: operation not permitted, unlink 'C:\Users\**\node_modules\.node-sass.DELETE\vendor\win32-x64-57\binding.node'

When I run "npm install", I get an error.
OS: Windows 10 npm: 6.2.0 node: v10.9.0
I already tried to "npm install" after "npm cache verify" but I couldn't solved it.
npm cache verify
npm instal
npm ERR! path
C:\Users\ipiag\products\tor\src\node_modules.node-sass.DELETE\vendor\win32-x64-57\binding.node
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink
'C:\Users\ipiag\products\tor\src\node_modules.node-sass.DELETE\vendor\win32-x64-57\binding.node'
npm ERR! { [Error: EPERM: operation not permitted, unlink
'C:\Users\ipiag\products\tor\src\node_modules.node-sass.DELETE\vendor\win32-x64-57\binding.node']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink
'C:\Users\ipiag\products\tor\src\node_modules.node-sass.DELETE\vendor\win32-x64-57\binding.node'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR!
'C:\Users\ipiag\products\tor\src\node_modules\.node-sass.DELETE\vendor\win32-x64-57\binding.node'
}, npm ERR!
stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink
\'C:\Users\ipiag\products\tor\src\node_modules\.node-sass.DELETE\vendor\win32-x64-57\binding.node\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR!
'C:\Users\ipiag\products\tor\src\node_modules\.node-sass.DELETE\vendor\win32-x64-57\binding.node',
npm ERR! parent: 'tor' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text
editor or antivirus),
npm ERR! or that you lack permissions to access it.
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 (though this is not
recommended).
npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\ipiag\AppData\Roaming\npm-cache_logs\2019-06-12T02_32_33_624Z-debug.log
In my case, i killed all nodejs running processes and it worked.
This usually happens when you are running node and then try to do an npm install in your project.
Check if you are running gulp like gulp build:server or any npm scripts (like npm run xxxx) for your project. Then stop those and you will be able to successfully complete npm install command.
I had the same problem, I manually removed .node-sass.DELETE from node_modules
Then run:
npm cache verify
npm install
On Windows, closing Node wasn't enough.
I had to open a shell in Admin Mode and stop all Node and Electron processes.
Here are the four apps I know can lock some files in node_modules directories
stop-process -Name node
stop-process -Name electron
stop-process -Name chromedriver
stop-process -Name chrome # ChromeDriver can spawn some apps during tests in hidden mode

Categories

Resources