4

I'm new Node.js development and I have a question about best practices when writing package.json files.

From my understanding, you have to list all devependences that you need to execute your app under "dependencies" in the package.json file. All your extra dependences that are required to run your test (or your build process) have to be listed in "devDependencies".

But what about tools that you additionally use, but which are not necessarily required by every developer. Take the node-inspector package as an example, which I installed globally on my machine but did not add to the package.json file.

Is that a good practice, or would you recommend to also file those packages as "devDependencies"?

3

devDependencies are packages you need in order to work on your project. Testing frameworks used in the project, mock APIs, CSS preprocessors (if you don't ship a compiled version) fit here.

node-inspector is not needed for you to run tests and make changes to parts of your code, so it should not be included in the package. Other users might use different debuggers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.