Nitro externalized package has incorrect main entry point
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v18.7.0
- Nuxt Version:
3.0.0-rc.8
- Package Manager:
pnpm@7.9.0
- Builder:
vite
- User Config:
modules
- Runtime Modules:
@nuxt/image-edge@1.0.0-27657146.da85542
- Build Modules:
-
Reproduction
https://github.com/mahdiboomeri/nuxt3-externalized-issue
Describe the bug
When using jsonwebtoken
with @nuxt/image
which both depend on semver
package, on the build step nitro tries to use the latest version.
In the server bundle main
entry of semver’s package.json points to index.js
but the index file is semver.js
.
Additional context
The reproduction uses rc8 but I also tested the issue with the edge channel.
Logs
# in the build step
WARN Multiple major versions of package semver are being externalized. Picking latest version. 14:58:38
- /path/to/project/nuxt-semver-issue/node_modules/.pnpm/jsonwebtoken@8.5.1/node_modules/semver@5.7.1
- /path/to/project/nuxt-semver-issue/node_modules/.pnpm/sharp@0.30.7/node_modules/semver@7.3.7
# when running node .output/server/index.mjs
[nuxt] [request error] [unhandled] [500] Cannot find module '/path/to/project/nuxt-semver-issue/.output/server/node_modules/semver/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:364:19)
at Module._findPath (node:internal/modules/cjs/loader:577:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
at Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (./.output/server/node_modules/jsonwebtoken/lib/psSupported.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:18 (3 by maintainers)
Top Results From Across the Web
Supercharged GitHub Experience · Volta - Volta.Net
`nuxi prepare` yields incorrect type definitions in target folder's `.nuxt`. enhancement ... Nitro externalized package has incorrect main entry point.
Read more >Untitled
Brakhet, Impronte digitali uguali, Karin roepke atriz, The beat is mine various ... 5 vaxt namaz vaxtlari 2012, Entry point not found exception...
Read more >Untitled
Hell is for children pat, Demo 1 intro, Fidget bands for chairs, Medicine from ... Enventis cable packages, Braided bracelets by john hardy,...
Read more >Change log for 4.6.50
Infof #526 · Bug 1868324: oc logout should make the token invalid #521 ... Bug 1894195: Operator should use entrypoint script #633 ...
Read more >Untitled
Consideration is valid unless it is, Wire color code, V8 vantage cover? ... I9080, Name of main rec, Salariu parlamentar 2012, El debate...
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
I am seeing this issue still with rc12. The below error is generated for multiple packages:
Then at
nuxi preview
:npm ls parse5
:Same happens for packages
pako
,uuid
,readable-stream
,@xmldom/xmldom
andtslib
. Possibly these changed their module formats between major versions, and that is throwing the compiler off?@danielroe Hey, It seems like the issue isn’t resolved (RC 11). This time the
semver.js
isn’t generated. I’ve updated my reproduction.