tacoss / grunt-nightwatch

Run your Nightwatch.js tests with Grunt
50 stars 22 forks source link

Redundant nightwatch installation #63

Closed davidlinse closed 8 years ago

davidlinse commented 8 years ago

As far as i can see/tell one needs to have NightwatchJS installed as local module.

When running $ npm list you'll get

├─┬ grunt-nightwatch@0.5.3
│ └─┬ nwrun@0.1.1
│   └─┬ nightwatch@0.8.18       <-- nightwatch is already present in project
│     ├─┬ chai-nightwatch@0.1.1
│     │ ├── assertion-error@1.0.0

But having NightwatchJS installed globally or not at all will result in a error like: 'Can not find module "nightwatch" error.'

You'll need to run $ npm install nightwatch inside you project to get rid of this error. Is this the intended behaviour ?

Best regards ~david

pateketrueke commented 8 years ago

Actually that was totally intended, but recently I'm fan of discover-and-require techniques for loading modules from local, parent or global installations. That approach allows us to put the required dependency wherever we like to... let me update nwrun to do the same so, thanks for your feedback!

pateketrueke commented 8 years ago

Not sure if solved but I've released a nwrun patch for that, could you npm update ?

davidlinse commented 8 years ago

Hi.. I've triggered an npm update with no change.. I've reinstalled grunt-nightwatch and the included dependency is gone..

├─┬ grunt-nightwatch@0.5.3
│ └─┬ nwrun@0.2.0
│   └── deduct@0.0.1

It works with Nightwatch as "local" dependency but still fails with Nightwatch installed globally.

regards ~david

pateketrueke commented 8 years ago

Which version of node/npm you're using?

Can you share the output of the following command?

$ npm root -g
davidlinse commented 8 years ago

Sure..

$ npm root -g
  info - it worked if it ends with ok
  info - using yapm@2.4.2
  info - using node@v0.10.28
/usr/local/lib/node_modules
  info - ok

regards ~david

pateketrueke commented 8 years ago

Seems like you're running non-standard NPM and an older version of NodeJS... I'm not sure if everything will work in your system because deduct relies on execSync and isn't supported for your version...

If you can test the following snippet would be great:

console.log(require('child_process').execSync('npm root -g').toString());
pateketrueke commented 8 years ago

Update: another solution would be using npm link nightwatch inside your project, that way you link the global dependency locally.

pateketrueke commented 8 years ago

I'm closing this since npm link is a good solution.