'My react app doesn't work on localhost. How can I solve this Error?
npm install -g serve
serve -s build
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/serve/bin/serve.js
npm ERR! dest /usr/local/bin/serve
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/serve/bin/serve.js' -\> '/usr/local/bin/serve'
npm ERR! \[Error: EACCES: permission denied, symlink '../lib/node_modules/serve/bin/serve.js' -\> '/usr/local/bin/serve'\] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/serve/bin/serve.js',
npm ERR! dest: '/usr/local/bin/serve'
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/arya/.npm/\_logs/2022-03-22T10_45_08_509Z-debug-0.log
zsh: command not found: serve
I did npm run build but I couldn't install server. How can I start my App again?
Solution 1:[1]
Within a react project the standard for running a project locally seems to be either of these:
- npm run start
- npm run dev
And for building:
- npm run build
I also recommend ensuring you have the correct Node version, the right one for React is the LTS[16.14.2] version found here https://nodejs.org/en/ For some reason, the Current[17.7.2] has some problems regarding React.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
