I'm doing a tutorial on VueJS. I am completely new to this, so not enitrely sure what I am doing. I followed all instructions, installed all packages, here is the check I made in terminal in VSCode:
PS C:\Users\...\Documents\Vue - Getting Started> node --version
v12.18.0
PS C:\Users\...\Documents\Vue - Getting Started> npm --version
6.14.5
PS C:\Users\...\Documents\Vue - Getting Started> vue --version
@vue/cli 4.4.1
However, whenever I try to npm run serve
as it's shown in the tutorial, it shows an error stating that a package.json
is missing:
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\...\package.json'
I checked, and indeed, I don't have a file called package.json
in my user folder. I only have a file called package-lock.json
.
I also noticed, that on the tutorial video, the terminal has something like 1: node
, while in mine, I can see 1: powershell
. Here is the screenshot:
What am I missing? Thank you
As suggested by El, I did npm init
and created a package.json
file in my project folder. Inside, I added the bit suggested by El. The whole package.json
file now looks like this:
{
"name": "package.json",
"version": "1.0.0",
"description": "package json",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "node index.js"
},
"author": "",
"license": "ISC"
}
And I am now getting this error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! package.json@1.0.0 serve: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the package.json@1.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?