Search code examples
node.jsnpmcucumbernvm

sh: 1: cucumber.js: not found


Trying to use this tutorial here:

https://github.com/lykmapipo/nodejs-cucumber-sample

The output to nvm current is: v10.12.0.

The output to npm --version is: 6.4.1>

I get the error below once I invoke npm test:

> [email protected] test /home/gnuc/code/nodejs-cucumber-sample
> cucumber.js

sh: 1: cucumber.js: not found

I am not sure as to why this is the case. The $PATH includes /home/gnuc/.nvm/versions/node/v10.12.0/bin. And I have already used npm install cucumber -g and npm install cucumber


Solution

  • Make sure that your package.json file includes this: "test": "cucumber-js"

    So that it looks something like this:

    {
          "name": "hellocucumber",
          "version": "1.0.0",
          "description": "",
          "main": "index.js",
          "scripts": {
            "test": **"cucumber-js"**
          },
          "keywords": [],
          "author": "",
          "license": "ISC",
          "devDependencies": {
            "cucumber": "^5.1.0"
          }
        }