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

🐛 BUG: Cannot find package "@babel/types" on the CLI #3843

Closed
1 task
jackmerrill opened this issue Jul 7, 2022 · 4 comments · Fixed by #3863
Closed
1 task

🐛 BUG: Cannot find package "@babel/types" on the CLI #3843

jackmerrill opened this issue Jul 7, 2022 · 4 comments · Fixed by #3863
Assignees
Labels
- P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)

Comments

@jackmerrill
Copy link
Contributor

What version of astro are you using?

v1.0.0-beta.64

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

yarn

What operating system are you using?

Windows

Describe the Bug

When creating a new project via yarn astro create, the following error is logged on any astro command:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '...\node_modules\@babel\types\' imported from ...\node_modules\astro\dist\core\add\babel.js
    at new NodeError (node:internal/errors:372:5)
    at legacyMainResolve (node:internal/modules/esm/resolve:317:9)
    at packageResolve (node:internal/modules/esm/resolve:895:14)
    at moduleResolve (node:internal/modules/esm/resolve:957:20)
    at defaultResolve (node:internal/modules/esm/resolve:1173:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:604:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

This may very well be an issue with my computer, as any other instances work, however other pre-existing Astro projects work on my computer.

Link to Minimal Reproducible Example

N/A

Participation

  • I am willing to submit a pull request for this issue.
@jackmerrill
Copy link
Contributor Author

Did a bit more digging, seems like Yarn/NPM isn't installing dependencies fully, in this case, @babel/types. What I mean by this is only the LICENSE, package.json, and README.md files are being installed, no actual code.

Manually installing these affected packages with version numbers seems to fix it.

@natemoo-re
Copy link
Member

Hey @jackmerrill! Thanks for opening an issue.

I'm working on a fix for this, should be out in the next version.

@natemoo-re natemoo-re self-assigned this Jul 8, 2022
@natemoo-re natemoo-re added s0-extra-small - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) labels Jul 8, 2022
@jackmerrill
Copy link
Contributor Author

I do remember seeing another package that may have been causing a similar issue, let me check really quick.

@jackmerrill
Copy link
Contributor Author

I do remember seeing another package that may have been causing a similar issue, let me check really quick.

Found the package: @babel/helper-validator-identifier, I get a similar error:

Error: Cannot find module 'D:\Code\babeltestthing\node_modules\@babel\helper-validator-identifier\lib\index.js'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:954:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:947:15)
    at resolveExports (node:internal/modules/cjs/loader:482:14)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\Code\babeltestthing\node_modules\@babel\types\lib\validators\isValidIdentifier.js:8:34)
    at Module._compile (node:internal/modules/cjs/loader:1099:14) {
  code: 'MODULE_NOT_FOUND',
  path: 'D:\\Code\\babeltestthing\\node_modules\\@babel\\helper-validator-identifier\\package.json'
}

natemoo-re added a commit that referenced this issue Jul 8, 2022
* fix(#3843): move @babel/types to dependencies

* chore: update lockfile

Co-authored-by: Nate Moore <nate@astro.build>
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this issue Feb 3, 2023
* fix(withastro#3843): move @babel/types to dependencies

* chore: update lockfile

Co-authored-by: Nate Moore <nate@astro.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants