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

Unable to package CLI app that uses "image-size" #80

Closed
ZaLiTHkA opened this issue May 8, 2017 · 4 comments
Closed

Unable to package CLI app that uses "image-size" #80

ZaLiTHkA opened this issue May 8, 2017 · 4 comments

Comments

@ZaLiTHkA
Copy link

ZaLiTHkA commented May 8, 2017

TLDR: I found Enclose, tried it and got an error. Found an issue report over there suggesting to use this instead. But I get the exact same message with Pkg.

Note: For the record, I do actually want to replace image-size with something that lets me do true image comparisons (currently I'm using the MD5 file hash, which is getting messy).

My console output is as follows:

D:\dev-sandbox\spotlight-extractor>pkg -t node6-win index.js
> Fetching base Node.js binaries to: ~/.pkg-cache
  fetched-v6.10.0-win-x86      [====================] 100%
> Warning Cannot resolve ''./types/' + type'
  D:\dev-sandbox\spotlight-extractor\node_modules\image-size\lib\index.js
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve ''./types/' + type'
  D:\dev-sandbox\spotlight-extractor\node_modules\image-size\lib\detector.js
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.

I have a few other projects and ideas that I want to package for distribution, but they're not yet ready for that just yet.. So for the sake of understanding this issue I'll ask my question using this project as reference for now.

Obviously modifying the library that causes the problem is one option, but is that the best way to handle this situation? Is there anything else that can be done to work around this?

@brunobg
Copy link

brunobg commented May 8, 2017

Add this to your package.json:

"pkg": {
    "scripts": [
      "./node_modules/image-size/lib/types/*.js"
     ]
}

@ZaLiTHkA
Copy link
Author

ZaLiTHkA commented May 9, 2017

Ah, I didn't quite understand what that what intended for from the project's readme file, sorry about that.. I also needed to add the bin entry to package.json and change the source file in my pkg command.

I still get the same warning now, so at first it doesn't look any different, but the generated executable now runs properly. 👍 Thanks.

@ZaLiTHkA ZaLiTHkA closed this as completed May 9, 2017
@igorklopov
Copy link
Contributor

Reopening to fix warning eventually

@igorklopov igorklopov reopened this May 14, 2017
@igorklopov
Copy link
Contributor

fixed in 3d87aca

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