Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown error #46

Open
REAZN opened this issue May 26, 2019 · 15 comments
Open

Unknown error #46

REAZN opened this issue May 26, 2019 · 15 comments

Comments

@REAZN
Copy link

REAZN commented May 26, 2019

Im getting an "UNKNOWN" errorno -4094
Code:

    figlet("Test", function(err, data) {
        if (err) {
            console.log(err);
            return;
        }
        message.channel.send('```' + data + '```')
    })```

Error:
`{ [Error: UNKNOWN: unknown error, open '//../fonts/Standard.flf']
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'open',
  path: '//../fonts/Standard.flf' }
`
@patorjk
Copy link
Owner

patorjk commented May 26, 2019

That path looks a little odd. I don't get that on my end, but I've updated the code so that kind of path should never arise. I've pushed a new version. If you update to v1.2.2, do you still get that error?

@REAZN
Copy link
Author

REAZN commented May 26, 2019

I have updated figlet but it's now trying to get the font from my E: drive?

{ [Error: ENOENT: no such file or directory, open 'E:\fonts\Standard.flf']
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'E:\\fonts\\Standard.flf' }

@patorjk
Copy link
Owner

patorjk commented May 26, 2019

Couple questions:

  • what directory are you running from?
  • what OS are you using?
  • what is the full path of the Figlet.js lib that’s running?
  • is the lib installed for a local project or globally?
  • where is node installed and what version of node are you using?

@REAZN
Copy link
Author

REAZN commented May 26, 2019

Directory: E:
OS: Windows 10
Path: E:\Discord\SupremeBotty\node_modules\figlet\lib
Installed: Local
Node: v10.15.3

@patorjk
Copy link
Owner

patorjk commented May 26, 2019

I wonder if this is a Windows path issue. Can you modify the node_modules/figlet/lib/node-figlet.js file and then on line 9 add:

console.log(__dirname);
console.log(fontDir);
console.log( path.join(__dirname, “../fonts/“);
console.log( path.join(__dirname, ‘..’, ‘fonts’); // I’m on mobile, you may have to fix the quotes

My guess is the last one should print out the correct path, if so, I’ll do another update.

@stubbo
Copy link

stubbo commented May 26, 2019

Looked into the issue for him, he was using it along side webpack.

Fixed it by the following to the webpack config
node: { __dirname: false }

@REAZN
Copy link
Author

REAZN commented May 26, 2019

I wouldn't exactly say that's a fix...

{ [Error: ENOENT: no such file or directory, open 'E:\Discord\SupremeBotty\fonts\Standard.flf']
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'E:\\Discord\\SupremeBotty\\fonts\\Standard.flf' }

@patorjk
Copy link
Owner

patorjk commented May 26, 2019

Wait, is this being transpiled? If so, it probably is a Webpack config error of some sort, or at least a problem how the code is being transpiled. __dirname should resolve to "your-app/node_modules/figlet/lib/", and it's joined with "../fonts", which gives the directory to the fonts folder.

Another option may be to use the new "importable-fonts" that I added to the project. I haven't yet tested these, which is why it's not advertised. However, I'm adding them for use in front-end apps that get transpiled. The fonts are actually there, and I envision them being used like this:

import standard from 'figlet/importable-fonts/Standard.js'
figlet.parseFont('Standard', standard);
figlet.text('test', {
    font: 'Standard',
}, function(err, data) {
    console.log(data);
});

Though again, I haven't tested these yet due to some computer issues I'm having.

@REAZN
Copy link
Author

REAZN commented May 30, 2019

Thanks for the alternative but for some reason, the new figlet update seems to be infinitely indexing my WebStorm on the huge amount of fonts it has, It seems to be happening on to a friend also.

@patorjk
Copy link
Owner

patorjk commented May 30, 2019

The fonts folder has 287 files, the new importable-fonts folder also has 287 files. That doesn't seem like it should cause such a problem.

@REAZN
Copy link
Author

REAZN commented May 30, 2019

I'm not sure why it is, but it is.

@patorjk
Copy link
Owner

patorjk commented May 30, 2019

I'm not familiar with WebStorm, but you may try marking the directory like shown here: https://stackoverflow.com/questions/36676075/webstorm-11-infinite-indexing-with-angular2

@REAZN
Copy link
Author

REAZN commented Jun 2, 2019

That alternative you suggested has not worked very well. It makes the text move slightly off Image, It works fine when I manually put the .flf into a new fonts folder in my projects directory (because of the path error mentioned previously) but the parsefont thing really messes up the font for me.

@cyberbobjr
Copy link

Hi,
same problem here with intellij 2019.1 : infinite indexing with figlet/lib directory :'(

@REAZN
Copy link
Author

REAZN commented Jun 27, 2019

@cyberbobjr I have a hacky fix for it, Just delete all the fonts and importable-fonts you don't use and it should fix the indexing. https://github.com/REAZN/figlet.js

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

No branches or pull requests

4 participants