Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Ben Os
Ben Os
20,008 Points

npm test instead npm SCRIPT-NAME

In this course here Andrew Chalkley runs the built-in NJS app "test" via the node test. Why no running it via a unique name? I mean, shouldn't there be a conflict in case of other packages.json scripts that also use test and that we don't want to run test for at the moment?...

1 Answer

Neil McPartlin
Neil McPartlin
14,662 Points

When you first open your node.js command prompt, the first thing you do is to navigate to the folder that contains the relevant package.json file. Once you are there, npm install, npm run, npm prune etc. and I guess npm test only work with that specific package.json file, hence no risk of an accidental interaction with another.