How to install expo CLI on macbook pro big sur? - ios

I an having issue regarding the installation of expo on the new mac.
When I run this command:
npm install --global expo-cli
I have the error:
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/theowatine/.npm/_logs/2020-11-21T09_26_14_033Z-debug.log
Does anyone know what could be the solution? Thank you for your help!

This is a common issue when using a globally-installed npm. The npm docs contain a page about it.
They recommend reinstalling node/npm with a version manager (like nvm). This is often a very good option if you are developing something locally. If you do that, this problem will go away. You can stop reading this answer if you want.
They also provide a way to configure npm to put the globally installed items in a directory of your choosing. That is a good option too, if a version manager won't work for you for whatever reason.
Another option they mention is using npx instead of globally installing the tool. I use this one a lot and like it quite a bit, but it does mean that you frequently have to remember to prefix commands you see with npx.
There are two somewhat common options that they do not list. One is to run your install with sudo. This means that any lifecycle scripts will get run as root on your machine. This is generally a bad idea (which is why they don't mention it in the docs), but is very common.
Another option is to chmod your /usr/local/lib/node_modules directory such that you can write to it. This is also a not-great idea in my opinion (which is probably why it too is not mentioned in the docs), but people do it.
In the case of expo-cli and in most developing-something-locally cases, installing with a package manager like nvm is probably the way to go.

I am also using macOS Big Sur on mbp and i experienced same issue. After reading Trott's answer i downloaded node from https://nodejs.org/en/download/ and installed it. Now expo and react native working fine.
Homebrew version of node is failed to install expo at all time but direct download from nodejs.org worked fine.

try this:
sudo npm install -g expo-cli

I am using Big sur(11.4) and I have downloaded latest version of node
https://nodejs.org/en/download/
Then run the following command for install expo and its working fine.
npm install --global expo-cli

Related

npm ERR! ENOTDIR: not a directory

This error suddenly showed up when we run build on our Jenkins server. We did not change anything.
npm ERR! Linux 3.10.0-957.5.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install"
npm ERR! node v10.15.3
npm ERR! npm v3.10.10
npm ERR! path /var/lib/jenkins/workspace/node_modules/.staging/#types/datatables.net-2acd857c/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open
We had the same error suddenly in the Jenkins build. We found out it was caused when running npm i on a specific module.
In our case it was caused because of an update that was made to a dependency package (#types/mime) in one the used packages (#types/serve-static).
Because the project is a legacy one, we could not update any packages, so to solve the issue we had to prevent the main package (#types/serve-static) from getting the latest version of the dependency ("#types/mime" "*").
The way to do that was by declaring the specific version package in package.json file instead of letting the package install the dependency itself
"#types/mime": "2.0.3"

Errors trying to publish npm package

I published fine last week but I tried today and it does not work on any of my computers. It is weird, at first I thought there was an issue with the service but then I started doing some solutions I found on the web and now I get this when I try npm adduser:
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/estebanpadilla/-/user/org.couchdb.user:ludusy
npm ERR! 404
npm ERR! 404 'org.couchdb.user:ludusy' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can only contain URL-friendly characters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/estebanpadilla/.npm/_logs/2020-08-11T03_27_17_364Z-debug.log
I looked all over for a possible solution but nothing seems to work.
npm whoami gives this result:
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/estebanpadilla/.npm/_logs/2020-08-11T03_29_57_501Z-debug.log
Does anyone have an idea on how to get it working again?
Thank you.
It looks like you're not logged in. I think you need to run npm adduser and follow the prompts.
Just a quick tip -- make sure to carefully read the error message. I think this line is telling you exactly what you need to do! npm ERR! need auth You need to authorize this machine using npm adduser.
It is working now, for some reason I was not able to run npm adduser or npm whoami on the project directory but I was able on any other directory so I figure there was something wrong with some configuration file inside the project. I removed any file that wasn't essential and it work.
Thanks for your help.

I wanna reinstall expo-cli, but there is err. And can't uninstall expo-cli

I tried to build the app through expo but failed, and I tried to reinstall expo-cli.
So, I entered the code below to remove the expo-cli.
npm -g uninstall expo-cli --save
and
(base) Bongui-MacBookPro:expo-firebase-master bong$ npm uninstall expo-cli -g
up to date in 0.042s
However, if i type expo, it will run.
So if you ignore it again and try to reinstall expo-cli,
The following errors occur:
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/expo-cli/bin/expo.js
npm ERR! dest /Users/bong/npm-global/bin/expo-cli
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/expo-cli/bin/expo.js' -> '/Users/bong/npm-global/bin/expo-cli'
npm ERR! File exists: /Users/bong/npm-global/bin/expo-cli
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/bong/.npm/_logs/2020-01-28T09_18_38_604Z-debug.log
Thank you, teachers.
Please help me solve the problem.
Thank you.
I think you might want to overwrite your current folder while you building.
Try and use the --force extension in your command and that will resolve the problem. I presume something like : npm install -g --force expo-cli
I hope that will help.
I am using linux , Ubuntu i tried
sudo npm install -g --force expo-cli
it worked for me.

Cannot read property 'map' of undefined npm ERR! code ELIFECYCLE npm ERR! errno 1 fir React Front End/Rails Backend

I get this error message when I run npm start:
Cannot read property 'map' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! quote-react-redux#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the quote-react-redux#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Anyone have an idea of what is going on? Or is there any documentation to read npm error logs as well?
I have gotten similar errors, ie. to reproduce one of mine:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-default#0.1.0 develop: `gatsby develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-default#0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The problem occurs when I am running a different version of node than the one I used to either generate the app with, or perhaps was cloned from elsewhere and forgot to run npm install.
Fix 1: Change the node version to the same version the app was generated with in the directory you are trying to launch the server via your node version manager.
Fix 2: Make sure you have the node version you want to run set in the directory you are working in, then npm install. You may want to do this in an new git branch, until you get it running, then merge into master, as sometimes if the versions were really different you may need to manually install additional packages (they will be listed).
Fix 3: Clear out and start from scratch (probably better than Fix 2). Try:
npm cache clean --force
rm package-lock.json
/bin/rm -rf node_modules/
npm install

How to install NPM end-user packages on NixOS?

Is there a way to install NPM command line tools on NixOS?
[root#ip-xxx-xxx-0-27:~/teros/ntrs-cli]# sudo npm i -g typescript
npm WARN checkPermissions Missing write access to /nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules
npm ERR! path /nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules
npm ERR! code EROFS
npm ERR! errno -30
npm ERR! syscall access
npm ERR! rofs EROFS: read-only file system, access '/nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
I assume because it's read-only, because I did run:
chown -R `whoami` nix/store/rhikjv5vlpa6vq4qkrszinwsaz1mda7p-nodejs-8.15.1
as an aside if someone knows how to install Node.js version 11 or 12 on nixos that'd be great.
Firstly, please undo the permissions change (chown) you made. You should NEVER change the permissions of files in the Nix store (/nix/store).
To install NPM packages on NixOS use the corresponding Nix package, instead of using npm -g .... NPM packages are under the nodePackages "namespace".
For example, to install typescript (tsc) edit /etc/nixos/configuration.nix:
...
environment.systemPackages = with pkgs; [
...
nodePackages.typescript;
]
...
Then use nixos-rebuild switch to "install" the package.
You can install Node.js the same way. Use nix search nodejs to see the various versions you can install.
Instead Edit ~/.npmrc so that it tells npm to install and find "global" packages in your home folder instead of the root location:
prefix=~/.npm-packages
now any time you run npm i -g <some-package> you will see that it will be installed inside of ~/.npm-packages.
Now in your shell rc file (f.e. .bashrc or .zshrc or similar), you'll need to update your PATH to include executables from the new location:
### Add NPM executables to your PATH so that they are available as commands:
export PATH="$HOME/.npm-packages/bin:$PATH"
Often it is more convenient to manage ephemeral dependencies outside of the system-level package manager.
If you use something like n or nvm to manage specific node versions, you can do a similar thing by managing them in your home folder.
npm config set prefix '~/mutable_node_modules'
This thread should be helpful:
https://github.com/NixOS/nixpkgs/issues/3393#issuecomment-50330167
https://github.com/NixOS/nixpkgs/issues/3393#issuecomment-187510024
You can also install them with the usual npm -i..., just without the -g (global) paramater.
looks like things may have changed a bit.
on fish shell with node v16.15.0 and nix (Nix) 2.8.1. I just had to add fish_add_path -g $HOME/.node_modules/bin to my config.fish then npm install -g <package>.

Resources