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

Error: Cannot find module './app' #21

Closed
macdonst opened this issue Aug 8, 2022 · 1 comment
Closed

Error: Cannot find module './app' #21

macdonst opened this issue Aug 8, 2022 · 1 comment

Comments

@macdonst
Copy link
Member

macdonst commented Aug 8, 2022

Steps to reproduce:

  1. Install the Begin CLI version 0.0.17.
  2. Create a new project begin new project --name new-proj --p ./new-proj
  3. cd into the newly created project
  4. Run begin dev. This should produce the error:
Error: Cannot find module './app'
Require stack:
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/config/pragmas/index.js
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/config/index.js
- /snapshot/cli/node_modules/@architect/hydrate/node_modules/@architect/inventory/src/index.js
- /snapshot/cli/node_modules/@architect/hydrate/src/hydrate.js
- /snapshot/cli/node_modules/@architect/hydrate/src/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/sandbox/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/index.js
- /snapshot/cli/node_modules/@architect/sandbox/src/cli/index.js
- /snapshot/cli/src/commands/dev/index.js
- /snapshot/cli/src/commands/index.js
- /snapshot/cli/src/index.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.

This just started happening after @architect/sandbox v5.3.2 was released.

If you:

  1. Clone the project at commit has 32228e436abf0a1ea691801510416ba06ab3dcae
  2. Update the @architect/sandbox dependency to v5.3.2
  3. npm run build
  4. and try to reproduce with the newly built binary then begin dev starts without complaint.

I'm at a loss as to why the updated @architect/sandbox package would affect the compiled binary.

@ryanblock
Copy link
Member

ryanblock commented Aug 9, 2022

Here's what's happening: Hydrate 3.0.4, released as a patch, requires Inventory 3.2.0; Sandbox 5.2.x uses Inventory 3.1.x; as such, npm resolves this and installs the specific version of Inventory necessary for Hydrate to run within a nested node_modules dir. Unfortunately, pkg does not package that nested module directory because it's not here: https://github.com/beginner-corp/cli/blob/main/scripts/binary-config#L22-L27

tl;dr this is expected behavior and, as you pointed it out, it's resolved once the CLI's Sandbox + Hydrate versions use the same version of Inventory.

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

No branches or pull requests

2 participants