I have been trying to use react native and create a project but have not been able to do so.
I am using the instructions from https://facebook.github.io/react-native/docs/getting-started.html
Node and watchman are already installed and then when I enter:
npm install -g react-native-cli
I get this:
/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js
react-native-cli#1.0.0 /usr/local/lib/node_modules/react-native-cli
├── semver#5.3.0
├── minimist#1.2.0
├── chalk#1.1.3 (ansi-styles#2.2.1, escape-string-regexp#1.0.5, supports-color#2.0.0, has-ansi#2.0.0, strip-ansi#3.0.1)
└── prompt#0.2.14 (revalidator#0.1.8, pkginfo#0.4.0, read#1.0.7, winston#0.8.3, utile#0.2.1)
When I try to do:
react-native init AwesomeProject
I get:
This will walk you through creating a new React Native project in /Users/jaimito/AwesomeProject
Installing react-native package from npm...
npm WARN peerDependencies The peer dependency react#~15.2.1 included from react-native will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.4.0/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-exact" "react-native"
npm ERR! node v6.4.0
npm ERR! npm v2.15.9
npm ERR! path /Users/jaimito/.npm/optimist/0.6.1
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/Users/jaimito/.npm/optimist/0.6.1'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, mkdir '/Users/jaimito/.npm/optimist/0.6.1'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/Users/jaimito/.npm/optimist/0.6.1',
npm ERR! parent: 'react-native' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jaimito/AwesomeProject/npm-debug.log
`npm install --save --save-exact react-native` failed
How do I prevent the errors?
I am working on a Mac.
I used sudo at the beginning of the command. But when I did:
cd AwesomeProject
react-native run-ios
I got:
fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/Users/jaimito/.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at save (/Users/jaimito/AwesomeProject/node_modules/react-native/node_modules/babel-register/lib/cache.js:53:16)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
I tried using sudo at the beginning and I got this:
fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/Users/jaimito/.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at save (/Users/jaimito/AwesomeProject/node_modules/react-native/node_modules/babel-register/lib/cache.js:53:16)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
~
Process terminated. Press <enter> to close the window
Try starting the command with sudo, it'll give your command the permission to create directories in the necessary places.
If you're on windows, try open the command line with admin permissions.
If you're on mac or linux, type sudo at the begining of the command.
Either way. Make sure your target directory doesn't already exist.
For me the marked directory inside the .npm directory belonged to root:wheel. Try to get it back ;) (or the 0.3.* directory inside marked)
chown -R `whoami` ~/.npm/marked
Or if necessary
sudo chown -R `whoami` ~/.npm/marked
Related
I want to create a new react native project. At first, I faced a problem when I ran npm install -g expo-cli and I solved it by installing nvm, then installing node and npm by nvm. When I ran expo init NewProject, I got this error.
Could you help me solving it, please?
Uncaught Error [Error: EACCES: permission denied, open
'/home/pgf/.expo/state.json.1309825572'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/home/pgf/.expo/state.json.1309825572'
}
I tried sudo expo init; I got this ✖ Something when wrong installing JavaScript dependencies. Check your npm logs. Continuing to initialize the app. and it created a project. Bur when I ran the project with expo start I got this error
Uncaught Error [Error: EACCES: permission denied, open '/home/pgf/.expo/state.json.2684774492'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/home/pgf/.expo/state.json.2684774492'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pgf/.npm/_logs/2020-05-29T19_37_07_602Z-debug.log
and this error when I ran it with sudo expo start
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
Could you help me solving this?
For me, there was no need to run it with sudo, since I ran into permissions errors. I had to reinstall expo-cli globally without using sudo. After that in your project directory:
sudo rm -rf ~/.expo
npm run start
I'm trying to install Angular-CLI so I can use Ionic framework, however the installation keeps crashing and gives me an error as such.
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/me/.npm/_logs/2019-05-31T09_00_09_770Z-debug.log
I've tried installing it by writing
sudo npm install -g #angular-cli
I've also tried installing it though this method here:
Can't install angular-cli on Mac
I'm sorry, I'm fairly new to this so I'm unsure on what information I should be providing.
I've installed Node JS (10.16.0)
I've also just installed the Ionic Framework and Cordova, however whenever I try opening a project that I create through the terminal, it tells me that I need to install Angular-CLI and once I say yes to the installation, I receive the same errors as above.
My MacOSX is 10.14.5
EDIT:
I've assigned read and write permission to my current user login on my computer but I'm still getting errors. When I run Ionic lab in my terminal to open my project the terminal asks me if I want to install angular and I write Yes. Then I get these errors.
[ng] Could not find module "#angular-devkit/build-angular" from "/Users/me/project".
[ng] Error: Could not find module "#angular-devkit/build-angular" from "/Users/me/project".
[ng] at Object.resolve (/Users/me/project/node_modules/#angular-devkit/core/node/resolve.js:141:11)
[ng] at Observable.rxjs_1.Observable [as _subscribe] (/Users/me/project/node_modules/#angular-devkit/architect/src/architect-legacy.js:153:40)
[ng] at Observable._trySubscribe (/Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:44:25)
[ng] at Observable.subscribe (/Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:30:22)
[ng] at /Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:99:19
[ng] at new Promise (<anonymous>)
[ng] at Observable.toPromise (/Users/me/project/node_modules/#angular-devkit/architect/node_modules/rxjs/internal/Observable.js:97:16)
[ng] at RunCommand.runSingleTarget (/Users/me/project/node_modules/#angular/cli/models/architect-command.js:161:86)
[ng] at RunCommand.runArchitectTarget (/Users/me/project/node_modules/#angular/cli/models/architect-command.js:201:35)
[ng] at RunCommand.run (/Users/me/project/node_modules/#angular/cli/commands/run-impl.js:14:25)
[ng] at RunCommand.validateAndRun (/Users/me/project/node_modules/#angular/cli/models/command.js:124:31)
[ng] at process._tickCallback (internal/process/next_tick.js:68:7)
[ng] at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
[ng] at startup (internal/bootstrap/node.js:283:19)
[ng] at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error
details.
If anybody here is running into the same issue as me, basically what I had done was I ran
sudo chown -R $(whoami) ~/.npm*
in my terminal and then I restarted me computer. Once I did that I essentially just created a new Project and everything was added from there (including Angular CLI)
could anyone advise what I should do please?
My node and npm version as follows:
$ viviantekiMacBook-Air-2:~ Vivi1an$ node -v
v8.11.1
$ viviantekiMacBook-Air-2:~ Vivi1an$ npm -v
5.6.0
I tried to install Angular CLI by following the instructions on their website but I got an error after I typed in npm install -g #angular/cli
Error info as below:
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Vivi1an/.npm/_logs/2018-04-02T09_00_20_531Z-debug.log
viviantekiMacBook-Air-2:~ Vivi1an$
I have downloaded node.js in a local folder to use Babel, not sure if this has anything to do with it?
Many thanks!
sudo npm install -g #angular/cli
i have the same problem I give way perhaps work with you
This is how to solve it. Run this command:
sudo chown -R $USER /usr/local/lib/node_modules
sudo means we are running this command as root, the system super user. This is because we don’t have permission to write to that folder, but root will be able to fix any permission. This command also means the system will ask for your password to confirm.
chown is the command we use to change the owner of a file or folder. We set the -R option to change the owner recursively, so we also get owner access to all the files already contained in there.
$USER is an environment variable automatically set to your username.
And the final piece is the folder path.
Running this path will make the folder yours, so you can safely run your npm install -g commands!
i go with the previous answer i put it and i install angular well,
but i appear for me another maybe also related with
npm audit
for resolve, it follows this question link answer
how to fix the npm audit report
i hope is a benefit for you
I've provisioned a default clean node.js app via Elastic Beanstalk, and have a node.js script trying to run npm install inside the project directory (/var/app/current/deploy-dist), however, the following permission error is thrown:
npm WARN locking Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm WARN locking at Error (native)
npm WARN locking /tmp/.npm/_locks/staging-f212e8d64a01707f.lock failed { Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm WARN locking at Error (native)
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking syscall: 'open',
npm WARN locking path: '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock' }
npm WARN deploy-dist No description
npm WARN deploy-dist No repository field.
npm WARN deploy-dist No license field.
npm ERR! Linux 4.4.35-33.55.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path /tmp/.npm/_locks/staging-f212e8d64a01707f.lock
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/deploy-dist/npm-debug.log
The package.json is just a:
{
"dependencies": {
"node-fetch": "^1.3.3"
}
}
Running npm install with sudo obviously works, but is preferred to be avoided as a solution.
Setting NPM_CONFIG_PREFIX to a directory at ~ as per npm docs suggestion didn't work either, and the problem persists.
I suspect the problem lies in incorrect permissions for /tmp/.npm, which are
drwxr-xr-x 114 root root 4.0K Dec 27 17:04 .npm
This is confusing, as I expected a simple npm install to work out of the box.
UPDATE: Should not that the project directory already contains a node_modules folder, but even removing it and running npm install doesn't fix it.
I had this problem! You can use ebextensions to create a post-deploy script that changes the permissions of the tmp/npm/.locks folder.
In your node.js project, create a .ebextensions folder if you haven't got one already. Then, add a new config file, e.g. 00_create_postdeploy_script.config, with the following yaml:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_fix_node_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/_locks/
When you deploy, this will create a script in /opt/elasticbeanstalk/hooks/appdeploy/post called 99_fix_node_permissions.sh, which looks like this:
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/_locks/
Because it's in that post folder, it will be run automatically after your app has deployed -- and hence change the permissions as required.
EDIT: If you're having trouble with the permissions of the whole .npm folder, then you should change the last line of the config file to:
chown -R nodejs:nodejs /tmp/.npm/
I have had this problem in past and in my case cleaning the cache fixed my issue.
Please try this
npm cache clean
Hope it helps.
The following command will fix the issue. it worked for me.
sudo chown -R 1000:1000 "/home/user/.npm"
When I m running
sudo yo jhipster
, I m getting this error at the end of the creation process:
Error: EACCES, permission denied '/home/userxxx/.config/configstore/insight-yo.yml'
You don't have access to this file.
at Object.fs.openSync (evalmachine.<anonymous>:438:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:289:15)
at Object.create.all.get (/usr/lib/node_modules/yo/node_modules/configstore/configstore.js:33:29)
at Object.Configstore (/usr/lib/node_modules/yo/node_modules/configstore/configstore.js:26:44)
at new Insight (/usr/lib/node_modules/yo/node_modules/insight/lib/index.js:26:34)
at Object.<anonymous> (/usr/lib/node_modules/yo/cli.js:123:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I have tried :
chown userxxx /home/userxxx/.config/configstore/insight-yo.yml
But this doesn't help.
If I m trying to create my project without sudo, it ends with :
npm ERR! Error: EACCES, mkdir '/home/userxxx/.npm/each-async/0.1.3'
npm ERR! { [Error: EACCES, mkdir '/home/userxxx/.npm/each-async/0.1.3']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/userxxx/.npm/each-async/0.1.3',
npm ERR! parent: 'grunt-svgmin' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.16.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/userxxx/dev/workspace/blankjhipster
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /home/userxxx/.npm/each-async/0.1.3
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/userxxx/.npm/each-async/0.1.3'
npm ERR! not ok code 0
it appears that the folder 01.1.3 doesn't exits, I have the folder 1.1.0
If anyone knows about this issue...
I m using ubuntu 14.10
Thanks in advance.
First of all, you don't need to use sudo with jhipster. Please try the following
Delete your existing ~/.npm cache using sudo for one last time: sudo rm -r /home/userxxx/.npm
This was the last time to use sudo for this task, all the following commands should be run as user userxxx without sudo
Create your project directory and cd into it: mkdir /home/userxxx/my-jhipster-project && cd /home/userxxx/my-jhipster-project
Generate your project using jhipster: yo jhipster