question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Failed to resolve entry for package "@carbon/charts-svelte > @carbon/telemetry"

See original GitHub issue

Contact 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joshblackcommented, Sep 13, 2021

Hi all! 👋 Chiming in on the @carbon/telemetry side. This package provides a CLI which is why there is no main, module, exports, etc field in the package.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.

0reactions
dominikgcommented, Sep 14, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

carbon/charts-svelte fails when run in SvelteKit 1.0.0-next.162 ...
Failed to resolve entry for package "@carbon/charts-svelte > @carbon/telemetry". The package may have incorrect main/module/exports ...
Read more >
Failed to resolve entry for package "material-symbols"
I created 'app.css' file in the src folder. Added @import 'material-symbols'; at the top of its file. Imported app.css into __layout.svelte .
Read more >
Improve handling for hybrid svelte packages in automatic ...
These packages then can fail in vite's optimizer with an error like Failed to resolve entry for package "foo > bar". The package...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found