Next.js Discord

Discord Forum

npm run dev errors

Answered
bobonlan posted this in #help-forum
Open in Discord
getting errors trying to execute npm run dev, but i just made an app following the steps on the next.js website. it's looking for package.json in a different directory than where it is but i don't know why it's looking where it is
Answered by Polar bear
try cd website
View full answer

135 Replies

Polar bear
@bobonlan can you take an ss of ur terminal
theres that too if it helps
Polar bear
this error means that u are running in the wrong folder
so terminal applies to whatever file im clicked in on?
Polar bear
ye so the error is
ur package json is in the website folder
so if i click website and run npm run dev in terminal it should run?
@bobonlan so terminal applies to whatever file im clicked in on?
Polar bear
try cd website
Answer
u do cd website
then run
and show me
Polar bear
but it might not work cuz ur file structure is kinda wrong
no
shid
Polar bear
"cd website"
then enter
after that do npm run dev
show me now
it wroked
Polar bear
nice
Polar bear
but still ur file structure is wrong
just saying
but it'll work
what is wrong with it and how do i fix it
i wanna learn best practices now so i don't fall into the routine of wrong stuff
Polar bear
well
the website folder is cuzing the issues
i did npx-create-app@latest website
Polar bear
this shouldn't exist, but u can't really delete it without deleting the inside things
what would be the best course of action
i have done nothing to this project
@bobonlan i did npx-create-app@latest website
Polar bear
ye but idk about ur node modules being inside the website folder
I'd say keep everything under the folder "1"
and remove the website folder
but if u do the other stuff will be deleted
so u gotta move them first
i could just delete website and then in 1 do create app right
Polar bear
eeeh
now that'll give ya an error
I'd say delete the whole thing
since u didn't do anything yet
thats what i mean my bad
Polar bear
and run
create-next-app@latest .
with a dot
why cant i right click website and hit delete
Polar bear
means it'll run in ur current folder
no need to create a new one
@bobonlan why cant i right click website and hit delete
Polar bear
the app and the public folders would be gone
and the node modules
thats fine right
Polar bear
no
u gotta move them then delete it
by making a new one it would respawn them right?
Polar bear
yep
that's right
just delete everything
but i cant
Polar bear
exit ur vs code
okay
its closed
Polar bear
go to ur folders app
ok
Polar bear
go to documents then GitHub
then 1
delete this folder
then recreate it
delete 1 and recreate it?
i cannot
Polar bear
why
1 contains all of my projects ever
Polar bear
oooo
i cant figure out how to make 2
lol
Polar bear
I see
if i make a 2 in github manually will it show up in vscode
Polar bear
yep cuz u aren't navigating to 2 alone
balelr
baller
Polar bear
u can make it only show up
create a folder 2 inside GitHub
2 aint poppin up
Polar bear
cuz u navigated to 1
they won't pop up together
it opens 1 as soon as i open vs code
Polar bear
obviously
is this the first time u use vs code?
i mean i have some prior use but im new to coding in general
Polar bear
aaaah
makes sense cuz those are basic stuff
i dont get why it wouldnt open on the outermost possible folder
Polar bear
no insult intended
@bobonlan i dont get why it wouldnt open on the outermost possible folder
Polar bear
it'll just open the history
none taken, im needing to learn the basics
Polar bear
good
ctrl + shift + n
this will open a new window
and close the previous one
okay
Polar bear
now you'll have a welcome screen
screen shot
i accidentally hit github but i think this works
Polar bear
oh u opened a GitHub folder?
Polar bear
ye
GitHub will show 2
and 1
but I recommend u navigating to 2 alone
so u won't accidentally download stuff to 1
ah i see
Polar bear
mhm
so enter 2 this time then hit open
or like mark it
same thing
anyways that's it
u can mark it as an answer
so now in 2 do i do the create-next-app@latest
@bobonlan so now in 2 do i do the create-next-app@latest
Polar bear
with a dot
@bobonlan so now in 2 do i do the create-next-app@latest
Polar bear
create-next-app@latest .
this won't ask u to name a project
or no need for u to name a new folder inside 2
is this correct
Polar bear
bravo
what message should i mark as answer
lol
@bobonlan what message should i mark as answer
Polar bear
just mark the whole thing can't u?
cd website
that was the answer