Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 90,071 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!