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

Assets not being inferred or included manually #647

@mmcguff

Description

@mmcguff

I have an express API application where the POST routes will upload files into the directory structure temporarily. The files are uploaded into a folder called /uploads. In my code I have the following line:

 const filePathToMedia = path.join(__dirname, `../uploads/${apiFile}`);

which from my understanding of the documentation should auto-detect or infer that this directory /uploads should be included with the pkg when generating the executable.

However this doesn't appear to be happening. I get the following error when testing the POST route of my API:

  message:
   'Error: form-data: File or directory \'C:\\**\\app-name\\uploads\\test.wav\' was not included into executable at compilation stage. Please recompile adding it as asset or script.',     

This led me to think that maybe I needed to run pkg package.json vs pkg app.js and manually define my assets instead of depending on auto-detection of path.join to resolve them for me.

so I include this following in my package.json:

  "bin": "app.js",
  "pkg": {
    "assets": ["uploads/**/*"]
    },

However, I still get the same issue. Any ideas on what else I should try or to get my /uploads directory included? Any help would be really appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions