pkg icon indicating copy to clipboard operation
pkg copied to clipboard

"Warning cannot find module" (but module is still included)

Open rossiam opened this issue 2 years ago • 1 comments

What version of pkg are you using?

5.7.0

What version of Node.js are you using?

16.14.2

What operating system are you using?

MacOS

What CPU architecture are you using?

x86_64

What Node versions, OSs and CPU architectures are you building for?

node16-macos-x64, node16-linux-x64, node16-win-x64

Describe the Bug

The full warning we get on MacOS (intel) with Node v16.14.2 is:

> Warning Cannot find module '@smartthings/plugin-cli-edge' from '/Users/rossstenersen/dev/cli/smartthings-cli/packages/cli/bin'  in /Users/rossstenersen/dev/cli/smartthings-cli/packages/cli/bin/run

I also tested building this on Debian x86_64 with v16.16.0, v16.15.1 and v16.14.2.

I put a bunch of debug in to try to figure out why this was happening and noticed that immediately after this warning is emitted, the pkg tool starts adding files from the plugin it just warned it couldn't find. It doesn't appear to ever come across the module again. The binary that pkg builds works properly and does indeed include all the files from the @smartthings/plugin-cli-edge dependency.

I'm also confused about why it's reporting finding the plugin via the run command since it's a plugin and there is no specific require via the run command. (i.e. I would expect the package to be found only via the dependency listed in package.json and even thought I would have to include it in the list of assets.)

Expected Behavior

This warning seems superfluous to me but if it's correct, I would like to understand why it is happening so we can fix it or at the very least understand it enough to know if it is safe to ignore.

To Reproduce

  1. Clone https://github.com/SmartThingsCommunity/smartthings-cli
  2. run npm install
  3. run npm run build
  4. run npm run package

rossiam avatar Jul 12 '22 17:07 rossiam

I'm also wondering if this is related to issue #1336. (We don't directly use yarn but it is included because a library we use, oclif, uses it for plugins.)

rossiam avatar Jul 12 '22 17:07 rossiam

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] avatar Oct 11 '22 00:10 github-actions[bot]

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

github-actions[bot] avatar Oct 16 '22 00:10 github-actions[bot]

what's the point of those bots that keep closing issues, why they've been implemented, to begin with? the "reopen" option is not available as well.

otanim avatar Feb 05 '23 22:02 otanim

same, the executable works correctly

Planutim avatar Feb 27 '23 19:02 Planutim