By ibrahim
first of all, im making a retail website using react. I have almost everything down to complete the website in terms of coding. i shifted all my files over to the droplet (if its important to know how or what way i used, then ask me). Now, there’s a server and a client folder that i use to run the website.
But theres a problem when i run the client…this shows up in the droplet:
"root@snagged-it:~/snagged-it/snagged-it# npm start
snagged-it@0.1.0 start
react-scripts start
sh: 1: react-scripts: not found"
snagged-it is just the name of my client folder. ive been trying to figure out the solution to this for so long, im hoping someone has the answer.
heres the link to the code: www.digitalocean.com all my files are in the “snagged-it/src” folder. snagged-it is my client folder, while index.js is in my server folder.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
The issue you’re encountering is that react-scripts
(and likely other dependencies) aren’t installed on your DigitalOcean droplet. When you transferred your files over, you probably copied the source code but not the node_modules
directory, which contains all the installed packages.
Try to run
npm install
while in your app’s folder
Hi there,
The issue is that react-scripts
is not installed on your Droplet. This usually happens when you copy over your project without also installing its dependencies.
SSH into your Droplet and navigate to the client folder:
cd ~/snagged-it/snagged-it
Install the dependencies listed in your package.json
:
npm install
This should pull in react-scripts
and any other missing packages.
Once the install finishes, try starting the client again:
npm start
If you are planning to run this in production, you generally would not run npm start
on a React app directly. Instead, you would build it and serve the static files with something like Nginx:
npm run build
Then configure Nginx to serve the files from the build
directory.
For development or testing on the Droplet though, just making sure you have installed the dependencies in the right folder should fix the react-scripts: not found
error.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.