homebridge / camera-utils

Utilities to simplify homebridge camera plugin development
18 stars 8 forks source link

Invalid main entry at package.json #556

Closed mcm1957 closed 1 year ago

mcm1957 commented 1 year ago

Analysis

package.json states main : lib/index.js https://github.com/homebridge/camera-utils/blob/73c069f49cc62cfe3e61364d992c030118dbf883/package.json#L5

but there seems to be no lib folder at all

Please check

Expected Behavior

main shoul dreference an existing file

Steps To Reproduce

check package.json

Logs

n/a

Configuration

n/a

Environment

n/a

Process Supervisor

not applicable

Additional Context

No response

donavanbecker commented 1 year ago

@mcm1957 this is a typescript project, so you must build the project to get that folder.

mcm1957 commented 1 year ago

Ok sorry for wrong isue

tsightler commented 1 year ago

Was this not always a typescript project? Installing previous 2.2.0 version via NPM works fine, but 2.2.1 is completely missing /lib folder as far as I can see, that can't be right.

tsightler commented 1 year ago

Size of npm package also went from previous ~32KB, to just under 10KB. Something is not right with the NPM package. Users are reporting issues and I can reproduce, when I install 2.2.1 via npm I get only this:

total 16
-rw-r--r-- 1 tsightler tsightler 4414 Nov  5 10:31 CHANGELOG.md
-rw-r--r-- 1 tsightler tsightler   86 Nov  5 10:31 README.md
-rw-r--r-- 1 tsightler tsightler 2009 Nov  5 10:31 package.json
tsightler commented 1 year ago

@donavanbecker Sorry for directing to the wrong person above, thanks for re-opening. Let me know if there's anything I can do to help. We have at least one issue with homebridge-ring plugin for reference https://github.com/dgreif/ring/issues/1353#issue-1977811034.

mcm1957 commented 1 year ago

Ok, Let me talk again :-) I opened this issue as we have troubles installing ioBroker adpaters sinc some days.

Error reported is

Caught by controller[0]: Error: Cannot find module '/opt/iobroker/node_modules/@homebridge/camera-utils/lib/index.js'. Please verify that the package.json has a valid "main" entry

(for ref only: https://github.com/iobroker-community-adapters/ioBroker.ring/issues/614)

I'm not involved in solving the ioBorker problem in detail. But following the error message into this project the main entry looked broken to me.

In addtion the problem seems to have occured during the last days. Checking the github commit history I do not see any relevant change to package.json or the file structure.

tsightler commented 1 year ago

As I noted above, the problem is with the npm package. For some reason it doesn't have the /lib folders or the files that are in it. The packages here on Github itself is fine, but something was broken in the publish.

The temporary workaround until the maintainers of this project publish a fixed npm package is to just install the 2.2.0 version which still works fine.

donavanbecker commented 1 year ago

@donavanbecker Sorry for directing to the wrong person above, thanks for re-opening. Let me know if there's anything I can do to help. We have at least one issue with homebridge-ring plugin for reference https://github.com/dgreif/ring/issues/1353#issue-1977811034.

This was published from the GitHub action publish. From what I can see everything looks good. But that would be a good place to start if you have time to look into it.

If you find something, I can get a release out.

mcm1957 commented 1 year ago

lib directory is excluded by .gitignore. But this file is unchanged since 3 years

donavanbecker commented 1 year ago

yeah, it wouldn't be the .gitignore. That just prevents that folder from being published to Github, which you wouldn't want anyway.

tsightler commented 1 year ago

This was published from the GitHub action publish. From what I can see everything looks good. But that would be a good place to start if you have time to look into it.

If you find something, I can get a release out.

So I'm not an expert on Github actions, but my understanding is that each job runs in it's own clean virtual environment, however the current release.yml appears to run two jobs, "build_and_test" and "publish". The "build_and_test" job clearly runs "npm run build" as one of the step, but there's no such step in the "publish" job, so the published npm is missing the actual code.

donavanbecker commented 1 year ago

Was missing the prePublishOnly script.

v2.2.4 resolves this.

image