open-in-browser
                                
                                 open-in-browser copied to clipboard
                                
                                    open-in-browser copied to clipboard
                            
                            
                            
                        Expected a Target error
Error: Expected a target
Error: Expected a target
at module.exports (/Users/Tommy/.atom/packages/open-in-browser/node_modules/opn/index.js:9:25)
at Object.open (/Users/Tommy/.atom/packages/open-in-browser/lib/open-in-browser.coffee:22:5)
at Object.openEditor (/Users/Tommy/.atom/packages/open-in-browser/lib/open-in-browser.coffee:16:6)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:259:29)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:59)
at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:160:19)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:1179:28)
at EventEmitter.outerCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/application-delegate.js:312:25)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)
Thank you for reporting this @TmasLove
Yes sir, no problem-o.
Any idea on how to get around this?
Macos meet the same error, when the file name likes: scroll.html, vue.html, position.html...
@TmasLove I was able to reproduce the error, on an unsaved initial file (untitled). I haven't been able to reproduce it, on an existing file.
What's happening under the hood is that opn npm package is not getting a file path, so it's triggering that error.
I'm still getting this error on 0.5.2 when trying to open most .html files. Also seems to be happening with some other file extensions such as .json and .css with the same error message.
Let me know if there's any more info I can get for you to be able to track it down.
I haven't been able to try it out but if @brettgoss is getting errors, I probably will as well
I'm getting it too on the most basic html project.
I am also getting this error running OS X High Sierra.
EDIT: I uninstalled the package and tried installing by command line in Terminal and that worked.
I've also had issues this for quite a long time now. Still persists.
I had the same issue and I didn't notice that I had many packages outdated. I just updated all the packages and the issue was fixed.
I have had this and many similar problems when opening files located in directories other than Atom's working directory. As a work-around:
- To open the file in a new instance of Atom, do cd $PARENT_OF_FILE_TO_EDIT; atom .
- To open the file in a running instance, do cd $PARENT_OF_FILE_TO_EDIT; atom $FILE_TO_EDIT
This issue still persists for Atom users in Sept 2019
This is still going on in March 2020, Catalina OS.
I submitted a PR for this a year and a half ago. Nobody cared. The last commit was a year before that. The project contributors seem to have lost interest in maintaining the package. I thought about hunting them down and badgering them, but I know what happens to badgers. :fearful:
It's easy enough to fork this repo and fix the problem yourself (yay FOSS!). Just install your forked version (with a higher release number!) over the original APM.
I know this error is old... but I found this page when I was trying to figure out what was going on. Eventually, I noticed that this error is only caused when you right click outside of the file name itself - so it's failing to pick up the filename you want to open in a browser. If you make sure you click on the filename itself and then on 'open in browser' it seems to solve the problem.
This bug is still happening in 2022.
OS: macOS Monterey 12.3 open-in-browser version: 0.5.2
Bug report:
Error: Expected a target
Error: Expected a `target`
    at module.exports (/Users/georgeciesinski/.atom/packages/open-in-browser/node_modules/opn/index.js:9:25)
    at Object.open (/Users/georgeciesinski/.atom/packages/open-in-browser/lib/open-in-browser.coffee:24:5)
    at Object.openTreeView (/Users/georgeciesinski/.atom/packages/open-in-browser/lib/open-in-browser.coffee:21:6)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:352694)
    at CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:351169)
    at AtomEnvironment.dispatchContextMenuCommand (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:786983)
    at EventEmitter.t (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:795037)
    at EventEmitter.emit (events.js:223:5)
    at Object.onMessage (electron/js2c/renderer_init.js:115:818)