0

When I open the instructions to install CodeceptJS it offers the option to install the node_module both locally and globally. However only global install works. When I install codeceptjs locally in my express application then try to initialize the codecept install I get "bash: codeceptjs: command not found". Any ideas?

nodejs - v6.2.2, express - v4.13.4, using a mac

David Stewart
  • 335
  • 1
  • 4
  • 10

2 Answers2

1

If you install it locally, most likely it's not in your $PATH. You need to specify the full path to it. Assuming you're in the root of your project, type: ./node_modules/.bin/codeceptjs

Or you can re-export the PATH variable to include this path (unadvised).

motanelu
  • 3,945
  • 1
  • 14
  • 21
  • You can also create an NPM script. If you add something like `"scripts": { "at": "codecept run" }` in your package.json, you can run your tests without having to worry about the local path since NPM handles that for you: `npm run at` – Ates Goral Jan 16 '17 at 13:58
  • That too! Actually may prove to be a better solution is it's going to use it multiple times. For a one-time call, you can just specify the path directly. – motanelu Jan 16 '17 at 14:00
  • thanks...you were correct about needing the directory in front of the node_module command name. We shortened them by adding scripts to the package.json. Now we can use 'npm run [script_name]' – David Stewart Jan 24 '17 at 13:50
  • Running from the command line, `npx codeceptjs run --steps tests/00-login.test.js` with no space at the end gives 'codeceptjs command not found' add the space and all is good. – Nick T Aug 05 '20 at 08:07
0

"./node_modules/.bin/codeceptjs" run --steps should work fine

Ismail
  • 3
  • 2