npm run dev errors
Answered
bobonlan posted this in #help-forum
bobonlanOP
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
135 Replies
Polar bear
@bobonlan can you take an ss of ur terminal
Polar bear
this error means that u are running in the wrong folder
bobonlanOP
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
bobonlanOP
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
bobonlanOP
Polar bear
but it might not work cuz ur file structure is kinda wrong
no
bobonlanOP
shid
Polar bear
"cd website"
then enter
after that do npm run dev
show me now
bobonlanOP
it wroked
Polar bear
nice
bobonlanOP
Polar bear
but still ur file structure is wrong
just saying
but it'll work
bobonlanOP
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
bobonlanOP
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
bobonlanOP
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
bobonlanOP
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
bobonlanOP
thats what i mean my bad
Polar bear
and run
create-next-app@latest .
with a dot
bobonlanOP
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
bobonlanOP
thats fine right
Polar bear
no
u gotta move them then delete it
bobonlanOP
by making a new one it would respawn them right?
Polar bear
yep
that's right
just delete everything
bobonlanOP
but i cant
Polar bear
exit ur vs code
bobonlanOP
okay
its closed
Polar bear
go to ur folders app
bobonlanOP
ok
Polar bear
go to documents then GitHub
then 1
delete this folder
then recreate it
bobonlanOP
delete 1 and recreate it?
i cannot
Polar bear
why
bobonlanOP
1 contains all of my projects ever
Polar bear
oooo
bobonlanOP
i cant figure out how to make 2
lol
Polar bear
I see
bobonlanOP
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
bobonlanOP
balelr
baller
Polar bear
u can make it only show up
create a folder 2 inside GitHub
bobonlanOP
2 aint poppin up
Polar bear
cuz u navigated to 1
they won't pop up together
bobonlanOP
it opens 1 as soon as i open vs code
Polar bear
obviously
is this the first time u use vs code?
bobonlanOP
i mean i have some prior use but im new to coding in general
Polar bear
aaaah
makes sense cuz those are basic stuff
bobonlanOP
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
bobonlanOP
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
bobonlanOP
okay
Polar bear
now you'll have a welcome screen
screen shot
bobonlanOP
i accidentally hit github but i think this works
Polar bear
oh u opened a GitHub folder?
bobonlanOP
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
bobonlanOP
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
bobonlanOP
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
bobonlanOP
is this correct
Polar bear
bravo
bobonlanOP
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