Invalid exports main target for dist/tplink-lightbulb.modern.js
See original GitHub issueAttempted to run this from WSL and PowerShell, seeing this issue on both. Not very familiar with Node so potentially it’s an end user error or maybe this module is for specific version of node and pm?
Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "dist/tplink-lightbulb.modern.js" defined in the package config /mnt/c/Users/username/node_modules/tplink-lightbulb/package.json; targets must start with "./"
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
No "exports" main resolved in /app/node_modules/@babel ...
The issue is that a new system for exports has been created, ... feature in the exports file, it can fail if you...
Read more >How to fix “Error: No valid exports main found for ... - Dev Genius
Recently when I was developing for a React application that I hadn't pulled from the master branch in a while, I came across...
Read more >JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript ... Use of native JavaScript modules is dependent on the import...
Read more >Node.js v19.3.0 Documentation
_unrefActive(); DEP0128: modules with an invalid main entry and an index.js file ... DEP0166: Double slashes in imports and exports targets ...
Read more >Error [ERR_INVALID_PACKAGE_TARGET] for yarn create ...
... create-strapi-starter internal/modules/cjs/loader.js:438 throw e; ^ Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the quick response and lesson on npm! Seeing built files in dist directory now.
No. It has always been ignored from git. This is intentional.
dist
is built (before publish) and normally included in npm. It is not included in git (it’s bad practice to commit built things to git, for lots of good reasons.) npm defaults to what is in gitignore, minus a few files (README, LICENSE, anything referenced inbin
) but they are separate file-layouts.You can see the problem for yourself:
None of the source files or other entrypoints, that should be in there, are. Only
tplight.cjs
, which is the CLI wrapper.I was originally fixing the issue of all export statements in package.json (
exports
,main
,module
,unpkg
) all require relative (starts with./
) paths, now, when they didn’t use to. I madefiles
match, but I think it needs to not match (not start with./
) Very annoying.With the change, I get this message on publish:
so it should be good in tplink-lightbulb@1.7.7.