error occurred when run cypress command : "command not found : cypress"

Viewed 55

I have installed cypress on my Mac computer and checked it by this command

npx cypress --version

And here is the result

Cypress package version: 9.7.0
Cypress binary version: 9.7.0
Electron version: 18.0.4
Bundled Node version: 16.13.2

But when I ran this command

cypress run --spec cypress/integration/2-advanced-examples/BDD/ecommerce.feature --headed --browser

and this command

 cypress open

it said to me this error command not found : cypress

when I checked by this command

npx cypress run

it said to me that I had this error

Your pluginsFile is invalid: /Users/anhbui/Cypressautomation/cypress/plugins/index.js

Here is my index.js file

/**
 * @type {Cypress.PluginConfig}
 */
// eslint-disable-next-line no-unused-vars
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on('file:preprocessor', cucumber())
}

So, I do not know why i had this error ? Could you please help me to solve this error ? Thank you very much for your time.

0 Answers
Related