[Bug]: Failed to resolve entry for package "@carbon/charts-svelte > @carbon/telemetry"
See original GitHub issueContact Details
nstuyvesant@gmail.com
What happened?
@carbon/telemetry has the following package.json
{
"name": "@carbon/telemetry",
"description": "Collect telemetry data for projects at IBM using Carbon",
"version": "0.0.0-alpha.6",
"license": "Apache-2.0",
"bin": {
"carbon-telemetry": "./bin/carbon-telemetry.js"
},
"repository": "https://github.com/carbon-design-system/carbon",
"bugs": "https://github.ibm.com/carbon-design-system/carbon/issues",
"keywords": [
"carbon",
"carbon design system"
],
"publishConfig": {
"access": "public"
},
"dependencies": {
"@babel/parser": "^7.12.5",
"@babel/traverse": "^7.12.5",
"ci-info": "^2.0.0",
"configstore": "^5.0.1",
"fast-glob": "^3.2.4",
"fs-extra": "^9.0.1",
"got": "^11.8.0",
"semver": "^7.3.2",
"winston": "^3.3.3",
"yargs": "^16.1.1"
}
}
When a SvelteKit 1.0.0-next.162 project uses @carbon/charts-svelte that includes @carbon/telemetry in its dependencies, you will get an error like this whenever you start the SvelteKit dev server npm run dev -- --host --open
…
Failed to resolve entry for package “@carbon/charts-svelte > @carbon/telemetry”. The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package “@carbon/charts-svelte > @carbon/telemetry”. The package may have incorrect main/module/exports specified in its package.json. Error: Failed to resolve entry for package “@carbon/charts-svelte > @carbon/telemetry”. The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package “@carbon/charts-svelte > @carbon/telemetry”. The package may have incorrect main/module/exports specified in its package.json. at packageEntryFailure (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:43739:11) at resolvePackageEntry (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:43735:9) at tryNodeResolve (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:43511:11) at Context.resolveId (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:43373:28) at Object.resolveId (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:50342:55) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async /Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:76764:27 at async optimizeDeps (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:71535:31) at async runOptimize (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:75389:48) at async Object.createServer (/Users/nates/dev/shy-svelte/node_modules/vite/dist/node/chunks/dep-1be34a63.js:75418:9) file:///Users/nates/dev/shy-svelte/node_modules/@sveltejs/kit/dist/chunks/index.js:3371 throw new Error(‘Cannot close server before it is initialized’); ^
Error: Cannot close server before it is initialized at Watcher.close (file:///Users/nates/dev/shy-svelte/node_modules/@sveltejs/kit/dist/chunks/index.js:3371:10) at process.<anonymous> (file:///Users/nates/dev/shy-svelte/node_modules/@sveltejs/kit/dist/chunks/index.js:3198:9) at process.emit (node:events:394:28) at process.emit (node:domain:475:12) at process.exit (node:internal/process/per_thread:184:15) at handle_error (file:///Users/nates/dev/shy-svelte/node_modules/@sveltejs/kit/dist/cli.js:958:10) at file:///Users/nates/dev/shy-svelte/node_modules/@sveltejs/kit/dist/cli.js:1010:4 at processTicksAndRejections (node:internal/process/task_queues:96:5)
To fix it, add this line to node_modules/@carbon/telemetry/package.json:
"main": "./bin/carbon-telemetry.js",
Version
@carbon/charts@0.46.4 @carbon/charts-svelte@0.46.4
@sveltejs/kit@1.0.0-next.162
Data & options used
<script>
import { DonutChart } from '@carbon/charts-svelte'
import '@carbon/charts/styles.min.css'
</script>
Relevant log output
No response
Codesandbox example
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top GitHub Comments
Hi all! 👋 Chiming in on the
@carbon/telemetry
side. This package provides a CLI which is why there is nomain
,module
,exports
, etc field in thepackage.json
for a bundler to hook into. It should not be included in any output of a build.Definitely agreed on the license and visibility issue, the code is available on NPM but we’ll bring it over into the monorepo for it to be public.
If that is not your intent, then you should not add @carbon/telemetry to the dependencies of your public open source libraries. Instead add it directly to the internal projects at ibm you want to analyze as a devDependency. You can even keep it closed source then and noone will blink an eye.
Right now you are forcing down megabytes of useless-at-best dangerous-at-worst dependencies onto every user.