Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal server error: Failed to resolve entry for package "terminal-in-react". w/Vite #109

Open
UI369 opened this issue Feb 6, 2023 · 3 comments

Comments

@UI369
Copy link

UI369 commented Feb 6, 2023

Attempting to use the library with a new app. Tried it with CRA, didn't work, switched to Vite, another error.

I want to create an app with basically just this library, what's the happy path to making it work?

Internal server error: Failed to resolve entry for package "terminal-in-react". The package may have incorrect main/module/exports specified in its package.json.

my package.json:

{
  "name": "hooprunner",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "terminal-in-react": "^4.3.1"
  },
  "devDependencies": {
    "@types/react": "^18.0.27",
    "@types/react-dom": "^18.0.10",
    "@vitejs/plugin-react": "^3.1.0",
    "typescript": "^4.9.3",
    "vite": "^4.1.0"
  }
}

vite.config.ts:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
})
@UI369 UI369 changed the title Internal server error: Failed to resolve entry for package "terminal-in-react". Internal server error: Failed to resolve entry for package "terminal-in-react". w/Vite Feb 6, 2023
@UI369
Copy link
Author

UI369 commented Feb 6, 2023

Full errror:

5:44:11 PM [vite] Internal server error: Failed to resolve entry for package "terminal-in-react". The package may have incorrect main/module/exports specified in its package.json.
  Plugin: vite:import-analysis
  File: /Users/ui369/Workspace/Code/UI369/hooprunner/src/App.js
      at packageEntryFailure (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:22004:11)
      at resolvePackageEntry (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:22001:5)
      at tryNodeResolve (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:21736:20)
      at Context.resolveId (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:21487:28)
      at async Object.resolveId (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:41587:32)
      at async TransformContext.resolve (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:41334:23)
      at async normalizeUrl (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:39685:34)
      at async TransformContext.transform (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:39826:47)
      at async Object.transform (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:41660:30)
      at async loadAndTransform (file:///Users/ui369/Workspace/Code/UI369/hooprunner/node_modules/vite/dist/node/chunks/dep-3007b26d.js:39466:29)```

@unional
Copy link

unional commented Aug 3, 2023

The package does not include the src folder.

@sahinme
Copy link

sahinme commented Mar 26, 2024

If anyone faced with this issue you can fix it for now importing bundle js

import Terminal from "terminal-in-react/lib/bundle/terminal-react";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants