reddark
reddark copied to clipboard
Missing package.json
Hi, I just wanted to let you know that you only have your package-lock.json comitted.
i don't seem to actually have a package.json at all
What commands are you using to run it?
just node main.js
@Tanza3D I see that a package.json file is missing. I can help with that.
What packages are used in this project?
im pretty sure it's just socket.io and express, along with any packages they need. i'm unsure how package.json files help, so would be appreciated!
im pretty sure it's just
socket.ioandexpress, along with any packages they need. i'm unsure how package.json files help, so would be appreciated!
Well, if a contributor wanted to clone the project locally, it would be hard to know which packages are required. A package json file helps out that information in one place.
From the npm docs:
A package.json file:
- lists the packages your project depends on
- specifies versions of a package that your project can use using semantic versioning rules
- makes your build reproducible, and therefore easier to share with other developers
@Tanza3D it is pretty much common practice to provide a package.json with all the commands and dependencies (exact versions!) included in it so a Node.js dev can just run the usual npm install and npm start commands to get a dev setup up and running.
I can create a PR with the minimal set later but a package.json can basically be created with
npm init
# < at this point fill out the prompts, mostly defaults will work >
npm install -S express socket.io
And adding the following script to the "scripts" section:
"start": "node ./main.js"
Then check in the package.json. That's by the way where package-lock.json comes in as a shrink wrap for all dependencies. So I am surprised you didn't have one to begin with.