garris/BackstopJS

ENOENT error

coljung opened this issue · 14 comments

When i try to run this i get an error, i followed the steps and im not sure what im missing.

To get the error I went to the specified folder and ran gulp echo, this is the message received:

[11:51:14] Using gulpfile ~\Projects\git\myCoolProject\bower_components\backstopjs\gulpfile.js
[11:51:14] Starting 'echo'...
[11:51:14] Finished 'echo' after 2.22 ms

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)

Thanks!

It looks like there is a missing file. what is the path of your backstop.json file? What platform are you on? and can you post your config file contents?

I have the same problem on windows 8.

Path for the backstop.js file:
/myproject/backstop.json

Im on Win8

Also, by config file you mean my gulpfile.js?

Hi, Thanks, I meant this file --> myproject/backstop.json

This one will be hard for me to troubleshoot since I don't have a proper win8 machine. There must be an issue with installation. Admittedly, the process is not as straightforward as I would like.

Sure, here is the code:

{
"viewports" : [
{
"name": "phone",
"viewport": {"width": 320, "height": 480}
}
,{
"name": "tablet_v",
"viewport": {"width": 568, "height": 1024}
}
,{
"name": "tablet_h",
"viewport": {"width": 1024, "height": 768}
}
]
,"grabConfigs" : [
{
"testName":"name"
,"url":"../../index.html"
,"hideSelectors": [
]
,"removeSelectors": [
]
,"selectors":[
"nav"
,".jumbotron"
,"body .col-md-4:nth-of-type(1)"
,"body .col-md-4:nth-of-type(2)"
,"body .col-md-4:nth-of-type(3)"
,"footer"
]
}
]
}

oh, that is interesting... Couple of things.

Can you cd to here myCoolProject/bower_components/backstopjs and run gulp genConfig

Then run gulp echo -- you should get http://getBootstrap.com/ homepage in the console...

Please let me know how it goes... thanks!

Nope..
C:\Users\Pablo\Projects\git\myCoolProject\bower_components\backstopjs
λ gulp genConfig
[16:10:46] Using gulpfile ~\Projects\git\myCoolProject\bower_components\backstopjs\gulpfile.js
[16:10:46] Starting 'genConfig'...
[16:10:46] Finished 'genConfig' after 25 ms

but then i tried gulp echo:

C:\Users\Pablo\Projects\git\myCoolProject\bower_components\backstopjs
λ gulp echo
[16:12:26] Using gulpfile ~\Projects\git\myCoolProject\bower_components\backstopjs\gulpfile.js
[16:12:26] Starting 'echo'...
[16:12:26] Finished 'echo' after 3.15 ms

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)

Alrighty then, That looks broken. :(

Could you try running this... sudo npm install -g phantomjs

You can run that from any location -- it should install phantomjs globally. Someone recently commented they needed to do this -- but I haven't had a chance to verify it. Please do this and then cd back to myCoolProject/bower_components/backstopjs and run gulp echo again...

also, just to confirm, your config file now looks like this... yes?

{
    "viewports" : [
        {
         "name": "phone",
         "viewport": {"width": 320, "height": 480}
        }
        ,{
         "name": "tablet_v",
         "viewport": {"width": 568, "height": 1024}
        }
        ,{
         "name": "tablet_h",
         "viewport": {"width": 1024, "height": 768}
        }
    ]
    ,"grabConfigs" : [
        {
            "testName":"http://getbootstrap.com"
            ,"url":"http://getbootstrap.com"
            ,"hideSelectors": [
            ]
            ,"removeSelectors": [
                "#carbonads-container"
            ]
            ,"selectors":[
                "header"
                ,"main"
                ,"body .bs-docs-featurette:nth-of-type(1)"
                ,"body .bs-docs-featurette:nth-of-type(2)"
                ,"footer"
                ,"body"
            ]
        }
    ]
}

I also had this issue, I found that I had to run:
npm install phantomjs npm install -g casperjs

Shouldn't these be included in the package.json?

@coljung @Jenkosama Just checking in, were you able to resolve the issue?

Had the same problem when required libraries where missing for the dependency projects (namely PhantomJS and CasperJS).

In your console, execute the command phantomjs to see if it starts properly. Then also try casperjs to ensure that starts properly as well. (Ctrl+C to exit)

When executing casperjs I got an error stating that 'python' is not recognized as an internal or external command so I had to install Python, add it to the PATH, and restart the console.

This fixes the normal executing but still fails to perform the echo in Windows because the CasperJS process name is not correct,

Many thanks to @brutaldev for the bug fix!

Also, I think these comments will help a lot of win users who have not already loaded phantomjs, casperjs & python.

#14 has been merged in and will be released in v0.2.5.

I know this is a closed issue, but I had this problem and the above steps didn't quite work for me, I had everything installed and running independently, but as I'd installed casperjs a long time ago independently it existed elsewhere on my PATH:

You can work out if you're having the same problem by using:
On windows cmd:

where phantomjs
where casperjs

On windows 'bash' (mysys, gitbash, etc):

which phantomjs
which casperjs

It's easiest if they're all in the same location, for me I made that npm global installs, e.g: /c/Users/{USERNAME}/AppData/Roaming/npm/

casperjs was in a different location so I had to remove that reference (environment variables) and install it via:
npm install -g casperjs

hope that helps someone

@matt-newman, thanks for posting this.