Code Monkey home page Code Monkey logo

Comments (2)

Krinkle avatar Krinkle commented on July 17, 2024 1

Hi @matthewcornell!

What

The qunit command is reported as not found because you tried to execute it as a "global" command, but QUnit is usually best to install "locally" in a project, not globally.

Why

In the Bash shell, when you run a command, the first "word" refers to the name or path of a program. When you refer to a program by its name only (such as grep, node, or npm; instead of /usr/bin/grep or ./bin/qunit) then Bash will try to find a program by that name in the system-wide /usr/bin and /usr/local/bin directories (decided by thePATH environment variable).

I generally recommend that developers install tools like bash, Node.js and npm globally, and indeed that is what you have done. The choice to use QUnit (and which version) is specific to each software project, and you may be trying out multiple projects by multiple people. You might have a project in ~/Documents/foo/ that uses QUnit 1.x, and a project in ~/Documents/bar/ that uses QUnt 2.x. This is possible because each has their own package.json file that tells npm which version to install in the local node_modules directory.

How

When you run npm test, the npm tool creates a Bash context where the local node_modules/.bin/ directory is temporarily included to your Bash PATH, so that it can execute the qunit command. If you've used other packages via npm, these will work the same way. I recommend using npm test and package.json so that you avoid accidentally making your project dependent on a program that you have installed on your computer globally, without declaring it in your local package.json file. That way, when you share your program with someone else, or when you work on it from another computer, it still works the exact same way.

Answer

You can experiment with variations of commands, without needing to edit package.json, by using the npx command. This basically says "pretend to be inside a package.json 'script' context". For example: npx qunit -w will run ./node_modules/.bin/qunit -w.

from qunit.

matthewcornell avatar matthewcornell commented on July 17, 2024 1

What an amazingly friendly, detailed, and clear message. Much appreciated 👍 !

from qunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.