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

🐛 Cannot find module 'typescript' when run in commonjs #40

Open
ansonchieng opened this issue Oct 19, 2023 · 0 comments
Open

🐛 Cannot find module 'typescript' when run in commonjs #40

ansonchieng opened this issue Oct 19, 2023 · 0 comments
Labels
bug Places where Berryjam is not working like how it is designed. Bug can be small or large in scope.

Comments

@ansonchieng
Copy link
Contributor

Describe the bug

When attempting to run the project in CommonJS mode, an error occurs, stating that it cannot find the module typescript. This issue prevents the application from functioning as expected.

To Reproduce

  1. Create a new Node.js project and configure it to use CommonJS module system
  2. Install the "berryjam" package as a dependency for your project
  3. Copy the code from the README.md of the "berryjam" package. The code contains TypeScript-specific type and interface declarations, I removed them since I mentioned using CommonJS mode
  4. Execute the file to start the scanning process

Expected behavior

The application should be able to run in CommonJS mode without encountering this typescript module error.

Node Version

18.16.1

OS

No response

Browser

No response

Additional Context

Error Message:

Error: Cannot find module `typescript`
Require stack:
- ../node_modules/berryjam/lib/cjs/utils/compiler.js
- ../node_modules/berryjam/lib/cjs/vue-scanner.js
- ../node_modules/berryjam/lib/cjs/index.js
- ../main.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/tong/Documents/node_modules/berryjam/lib/cjs/utils/compiler.js:35:25)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19) {

  code: 'MODULE_NOT_FOUND',
@ansonchieng ansonchieng added the bug Places where Berryjam is not working like how it is designed. Bug can be small or large in scope. label Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Places where Berryjam is not working like how it is designed. Bug can be small or large in scope.
Projects
None yet
Development

No branches or pull requests

1 participant