Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Unable to find module 'protractor-timeline-plugin' without global installation #10

Open
nicklee1990 opened this issue Dec 12, 2016 · 9 comments

Comments

@nicklee1990
Copy link

nicklee1990 commented Dec 12, 2016

When I run protractor with this plugin (or any of the first party plugins in my configuration file), I get an error saying:

E/launcher - Error: Cannot find module 'protractor-timeline-plugin'

My config file plugins section,

plugins: [{
    package: 'protractor-timeline-plugin'
    outdir: 'timelines',
    outputHtmlFileName: 'results.html'
}]

It seems to work however if I install the plugin globally. Unfortunately installing globally isn't an option for me. Has this issue been seen previously/are there any known workarounds? Let me know if you need any more info or how I can help to debug it

Protractor version: "^4.0.10"

@nicklee1990 nicklee1990 changed the title Unable to find module Unable to find module 'protractor-timeline-plugin' without global installation Dec 12, 2016
@sjelin
Copy link
Contributor

sjelin commented Dec 15, 2016

Have you npm install'd protractor-timeline-plugin? Like, npm install --save-dev protractor-timeline-plugin?

@greyarch
Copy link

Same problem here. I have npm installed it, but I still get

Cannot find module 'protractor-timeline-plugin'

protractor-timeline-plugin 0.2.0
protractor 5.0.0
node 7.2.1

@sjelin
Copy link
Contributor

sjelin commented Feb 8, 2017

This may be an issue with npm/require not resolving things as I'd expect. If you change your config to:

plugins: [{
    inline: require('protractor-timeline-plugin'),
    outdir: 'timelines',
    outputHtmlFileName: 'results.html'
}]

does that solve the problem?

@greyarch
Copy link

greyarch commented Feb 9, 2017

This does indeed fix the problem. I can run a test now and get a HTML report in the timelines directory.

@sjelin
Copy link
Contributor

sjelin commented Feb 9, 2017

What's your npm version?

@greyarch
Copy link

npm version 4.0.5

@sjelin
Copy link
Contributor

sjelin commented Feb 13, 2017

Ok, so basically what's going on here is that both protractor and protractor-timeline-plugin are dependencies, but the plugin isn't a Protractor dependency, so Protractor can't find it with require. Once upon a time, in an earlier version of npm, co-dependencies could find each other. I guess this has since changed (this seems extremely surprising honestly, and I haven't checked on my machine, but it's the only explanation I can think of). For now, I suggest you use the inline or path option. Protractor should either find a solution of deprecate the package option.

@sjelin
Copy link
Contributor

sjelin commented Feb 13, 2017

Wait, are you running a version of Protractor which was globally installed or locally installed?

@greyarch
Copy link

@sjelin protractor is installed globally.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants