Aditya Singh Rawat
Aditya Singh Rawat

Reputation: 93

JavaScript NPM Error in visual studio code

In visual Studio Code , i want my javascript program to run and automatically through a server as , i'm learning javascript through a online.

i try to did the same steps as i watched a tutorial on Setup IDE .

so i installed Git and Node , now when i open Visual Studio , after saving a Hello World Program , it should run automatically .

so i type in Terminal : npm install then error came , then again i typed npm run dev to start my server in Browser.

i [the error in the pic is :
C:\Users\Addie\Desktop\JS\webpack-starter-master>npm install
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Addie\Desktop\JS\webpack-starter-master\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Addie\Desktop\JS\webpack-starter-master\package.json'
npm WARN webpack-starter-master No description
npm WARN webpack-starter-master No repository field.
npm WARN webpack-starter-master No README data
npm WARN webpack-starter-master No license field.

up to date in 10.317s
found 0 vulnerabilities

C:\Users\Addie\Desktop\JS\webpack-starter-master>npm run dev

npm ERR! path C:\Users\Addie\Desktop\JS\webpack-starter-master\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Addie\Desktop\JS\webpack-starter-master\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Addie\AppData\Roaming\npm-cache\_logs\2018-09-02T22_21_22_028Z-debug.log

]1

Please help me out , what should i do and what am i doing wrong?.

Upvotes: 0

Views: 2770

Answers (2)

JBallin
JBallin

Reputation: 9787

To run a JavaScript file locally (using node):

$ cd PATH_TO_PROJECT_FOLDER
$ node FILE_NAME

If you're trying to run a project which contains a npm run dev script to start up a server:

$ cd PATH_TO_PROJECT_FOLDER
$ npm install
$ npm run dev

Upvotes: 0

Mannaroth
Mannaroth

Reputation: 480

You need to do npm init to create a package.json for your directory

Upvotes: 1

Related Questions