I want to learn React-native and I am following the official docs. and I am using create-react-native-app for installation.
I am also working for a project in reactjs which is also installed using create-react-app.
When I tried to install react-native using cmd:
npm install -g create-react-native-app
I see the following error
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
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! stack: '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! Please try running this command again as root/Administrator.
My mac already has a node_modules which is created during Reactjs Installation.
And when I run npm install create-react-native-app the modules are installed but the cmd for creating react native app didn't get recognized.
$create-react-native-app hello
-bash: create-react-native-app: command not found
Is it possible to work both in react-native and reactjs?
Anything with -g requires a global install and requires sudo access. Because this installs globally.
sudo npm install -g create-react-native-app
Related
I get below error when npx create-react-app. please help me how to solve this problem.
nodejs version is v16.14.2 and npm version is 8.5.0
To address all issues (including breaking changes), run:
npm audit fix --force
(base) kiranrana#Kirans-MacBook-Pro react-app % npm install -g create-react-app
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/create-react-app
npm ERR! dest /usr/local/lib/node_modules/.create-react-app-DgI96EzL
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/create-react-app' -> '/usr/local/lib/node_modules/.create-react-app-DgI96EzL'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/create-react-app' -> '/usr/local/lib/node_modules/.create-react-app-DgI96EzL'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/create-react-app',
npm ERR! dest: '/usr/local/lib/node_modules/.create-react-app-DgI96EzL'
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! /Users/kiranrana/.npm/_logs/2022-07-12T12_00_07_463Z-debug-0.log
It looks like a permission denied error which could be caused due to incorrect installation of npm/node. Also, I just noticed that you are using kiranrana#Kirans-MacBook-Pro react-app % npm install -g create-react-app which is not recommended. I'd suggest you to use below command.
sudo npx create-react-app .
I just changed a new laptop to MacBook air using Catalina. I was successfully installed Node when I tried install Reactjs but it says 'permission denied' to node file as below:
zulfadliazhar#Zulfadlis-MacBook-Air ~ % npm install -g create-react-app
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!
/Users/zulfadliazhar/.npm/_logs/2020-05-15T01_03_00_850Z-debug.log
zulfadliazhar#Zulfadlis-MacBook-Air ~ % create-react-app --version
zsh: command not found: create-react-app
Please assist me.
Thank you
You need the sudo rights to install something in -g (it means global) because it will install it here => /usr/local/lib/node_modules
so you just need to retry like this sudo npm install -g create-react-app
I was going through "Modern React with Redux Course" on Udemy, there instructor asked to install NodeJs first and then to install " npm install -g create-react-app", When i tried to run this command , i got an error :-
npm install -g create-react-app
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
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! stack:
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! 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 (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nitintushir/.npm/_logs/2019-09-20T15_22_12_437Z-debug.log
then i go through a some questions on stackoverflow, where someone suggests to run this command :-
npm cache clean --force
to which i got :
npm WARN using --force I sure hope you know what you are doing.
then i run the
npm install -g create-react-app
command again , but still got the same error , any solution/suggestion ?
It look like an access right error, you should try running your install as root like:
sudo npm install -g create-react-app
You should use nvm to manage your node and npm versions.
https://github.com/nvm-sh/nvm
This would allow you to globally install node modules without any sudo permission
And also you can change your node version anytime you want with nvm CLI
i just started learn React Native. I've already installed Node.js on my mac, and then i try to install React Native by command "npm install -g create-react-native-app" (i followed the installation guide from its official website). But after that, the message below appeared:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
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! stack: '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! Please try running this command again as root/Administrator.
Can anybody tell me the root cause of this problem ? i'm glad if anyone can give me the clue so i can continue my journey to learn this technology (React Native), because i have plan to make a small IOS App Project using this. Thank you ^^.
Please try running this command again as root/Administrator.
run global install commands with sudo:
sudo npm install -g create-react-native-app
and enter your password.
I am trying to install cordova with npm install -g cordova in my ubuntu (15.10), but getting the following error
npm WARN locking Error: EACCES, open '/home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock'
npm WARN locking at Error (native)
npm WARN locking /home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock failed { [Error: EACCES, open '/home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock' }
npm ERR! Linux 4.2.0-30-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/cordova, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/gopi/npm-debug.log
I when i am trying to give ionic build android i am getting this error and also when i try cordova -v to check the current version i get the same error.
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES, permission denied '/home/gopi/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:500:18)
at Object.fs.readFileSync (fs.js:352:15)
at Object.create.all.get (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:123:23)
at checkForUpdates (/usr/local/lib/node_modules/cordova/src/cli.js:64:20)
at cli (/usr/local/lib/node_modules/cordova/src/cli.js:116:5)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/bin/cordova:41:1)
does any one have idea why the permission is denied, I also tried with sudo npm install -g cordova but still the same result.
It seems to be a permission problem, try:
sudo chown -R $(whoami) "$HOME/.npm"