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

Can't serve rollup bundle due to 'Could not find ${fileToRun}' error #23029

Closed
1 of 4 tasks
adexot opened this issue Apr 26, 2024 · 1 comment · Fixed by #23081
Closed
1 of 4 tasks

Can't serve rollup bundle due to 'Could not find ${fileToRun}' error #23029

adexot opened this issue Apr 26, 2024 · 1 comment · Fixed by #23081
Assignees
Labels
scope: bundlers Issues related to webpack, rollup scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@adexot
Copy link

adexot commented Apr 26, 2024

Current Behavior

The error below occurs when I try to serve an express app bundled with @nx/rollup:rollup:

/Users/aoseni/Temp/analysis-web/node_modules/@nx/js/src/executors/node/node.impl.js:287
throw new Error(Could not find ${fileToRun}. Make sure your build succeeded.);
^

Error: Could not find /Users/aoseni/Temp/analysis-web/dist/apps/ds-graphql-api/main.js. Make sure your build succeeded.
at fileToRunCorrectPath (/Users/aoseni/Temp/analysis-web/node_modules/@nx/js/src/executors/node/node.impl.js:287:11)
at /Users/aoseni/Temp/analysis-web/node_modules/@nx/js/src/executors/node/node.impl.js:97:49
at new Promise ()
at Object.start (/Users/aoseni/Temp/analysis-web/node_modules/@nx/js/src/executors/node/node.impl.js:91:36)
at Timeout.processQueue [as _onTimeout] (/Users/aoseni/Temp/analysis-web/node_modules/@nx/js/src/executors/node/node.impl.js:62:13)

Node.js v18.19.0

Expected Behavior

Express app should start correctly.

GitHub Repo

https://github.com/adexot/nx-express-rollup

Steps to Reproduce

  1. Run yarn to install the dependencies in the repo provided
  2. Run yarn nx run express-rollup:build-rollup to build the nx app
  3. Run yarn nx run express-rollup:serve to serve the app

The above should result in the error:
throw new Error(Could not find ${fileToRun}. Make sure your build succeeded.);

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.19.0
   OS     : darwin-arm64
   yarn   : 3.6.3
   
   nx                 : 16.10.0
   @nx/js             : 16.10.0
   @nx/jest           : 16.10.0
   @nx/linter         : 16.10.0
   @nx/workspace      : 16.10.0
   @nx/cypress        : 16.10.0
   @nx/devkit         : 16.10.0
   @nx/esbuild        : 16.10.0
   @nx/eslint-plugin  : 16.10.0
   @nx/next           : 16.10.0
   @nx/node           : 16.10.0
   @nx/plugin         : 16.10.0
   @nx/react          : 16.10.0
   @nx/rollup         : 16.10.0
   @nx/storybook      : 16.10.0
   @nrwl/tao          : 16.10.0
   @nx/web            : 16.10.0
   @nx/webpack        : 16.10.0
   typescript         : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@adexot
Copy link
Author

adexot commented Apr 26, 2024

The error above happens due to . being omitted from cjs.js at

const extensionsToTry = ['.cjs', '.mjs', 'cjs.js', '.esm.js'];

Rollup build generates a .cjs.js file correctly

@AgentEnder AgentEnder added scope: bundlers Issues related to webpack, rollup scope: node Issues related to Node, Express, NestJS support for Nx labels Apr 29, 2024
ndcunningham added a commit that referenced this issue Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: bundlers Issues related to webpack, rollup scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants