Installing Expo

May I ask how to solve this problem?

npm ERR! code EACCES

npm ERR! syscall mkdir

npm ERR! path /usr/local/lib/node_modules/expo-cli

npm ERR! errno -13

npm ERR! Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/expo-cli’

npm ERR! [Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/expo-cli’] {

npm ERR! errno: -13,

npm ERR! code: ‘EACCES’,

npm ERR! syscall: ‘mkdir’,

npm ERR! path: ‘/usr/local/lib/node_modules/expo-cli’

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/jingyizhang/.npm/_logs/2022-05-24T18_23_49_919Z-debug-0.log

Hi @jingyi0830

npm is trying to install expo-cli to /usr/local but your user does not have access to write there.

You can configure npm to write to your home directory by creating a file called .npmrc in your home directory containing:

prefix = ${HOME}/.npm-global

Hi sorry, could you be more specific? Like what codes should be run in my terminal?

Try this:

echo >> ~/.npmrc
echo 'prefix = ${HOME}/.npm-global' >> ~/.npmrc

Then after that, try:

npm install -g expo-cli

Hi sorry I think a new problem has arised because I got this:

npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated

npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.

npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.

npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies

npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies

npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.

npm WARN deprecated subscriptions-transport-ws@0.9.8: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md

npm WARN deprecated graphql-tools@3.0.0: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead

added 1520 packages, and audited 1521 packages in 2m

120 packages are looking for funding

run `npm fund` for details

**25** vulnerabilities (12 **moderate** , 13 **high** )

To address issues that do not require attention, run:

npm audit fix

To address all issues (including breaking changes), run:

npm audit fix --force

Run `npm audit` for details.

Then I run npm audit fix --force and got these:

npm WARN using --force Recommended protections disabled.
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jingyizhang/.npm/_logs/2022-05-25T15_06_20_714Z-debug-0.log
jingyizhang@Jingyis-MacBook-Pro ~ % npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR! 

Hi again

Please ignore those deprecation warnings. I agree that they are ugly and possibly scary, but they are actually normal :confused:

See here for some thoughts on this:

It looks like expo-cli is installed correctly now.
One thing I forgot to mention: You will need to add the .npm-global/bin directory to your PATH.

Check which shell you’re using:

ps -p $$

It should say something about “bash” or “zsh”.

For bash:

Edit /Users/jingyizhang/.profile or /Users/jingyizhang/bash_profile (if you have neither, create one and edit it).

For zsh:

Edit /Users/jingyizhang/.zshrc (if it doesn’t exist, create it and edit it).

Add the following to the .profile or .bash_profile or .zshrc file:

export PATH=$PATH:~/.npm-global/bin

Then logout and back in again.

After that, try running expo --version in your terminal.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.