简体   繁体   中英

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?.

您需要执行npm init为目录创建package.json

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM