Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Julieta Dalla Pozza
Julieta Dalla Pozza
4,337 Points

Creat react app error

Hello im trying to create a react app and im having this error.

LadyLos-MBP:XAILABS ladylo$ npm install -g create-react-app npm ERR! code EACCES npm ERR! syscall mkdir npm ERR! path /usr/local/lib/node_modules/create-react-app npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/create-react-app' npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/create-react-app'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/usr/local/lib/node_modules/create-react-app' 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/ladylo/.npm/_logs/2022-06-03T09_38_49_396Z-debug-0.log LadyLos-MBP:XAILABS ladylo$

Could someone give me a hint to solve this? Thank u in advance

1 Answer

Torben Korb
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Torben Korb
Front End Web Development Techdegree Graduate 91,390 Points

Hi Julietta,

it seems like a permission error in the environment you're trying to install a npm package globally.

You can try to install your application by running following:

npx create-react-app my-app

...where 'my-app' is the folder everything is installed. The npx command does not rely on any locally installed packages but runs the package directly from the npm repository. The create-react-app package is just a generator and this is fine.

Hope this helps. Happy coding!