You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nx build command works and generates the necessary output files in the expected directory. However, running the nx serve command fails with the following error:
[ watch ] build succeeded, watching for changes...
/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
^
Error: Could not find /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/dist/apps/night-owl-server/main.js. Make sure your build succeeded.
at fileToRunCorrectPath (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312:11)
at /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:98:49
at new Promise (<anonymous>)
at Object.start (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:92:36)
at async Timeout.processQueue [as _onTimeout] (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:63:13)
The main.js file exists in the dist/apps/night-owl-server directory after running the build command, but the serve command is unable to locate it.
Expected Behavior
The nx serve command should:
Trigger the nx build command to generate the necessary files.
Locate the generated main.js file in the dist/apps/night-owl-server directory and execute it.
This behavior is expected for a newly generated Node.js application.
Steps to Reproduce
Clone the repository and checkout the night-owl-server branch:
git clone https://github.com/Lamar1806/Ikigai.git
cd Ikigai
git checkout night-owl-server
Install dependencies:
npm install
Build the application:
nx build night-owl-server
Verify that the build generates the main.js file in the correct directory:
ls dist/apps/night-owl-server
Serve the application:
nx serve night-owl-server --verbose
Observe the error:
[ watch ] build succeeded, watching for changes...
/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
^
Error: Could not find /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/dist/apps/night-owl-server/main.js. Make sure your build succeeded.
Failure Logs / Images / Videos
Error Logs:
[ watch ] build succeeded, watching for changes...
/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
^
Error: Could not find /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/dist/apps/night-owl-server/main.js. Make sure your build succeeded.
at fileToRunCorrectPath (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312:11)
at /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:98:49
at new Promise (<anonymous>)
at Object.start (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:92:36)
at async Timeout.processQueue [as _onTimeout] (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:63:13)
Environment
Nx Console version:(Specify if applicable)
VSCode version: 1.96.2
Nx version: 20.3.0
Node.js version: 23.4.0
OS: macOS
nx report Output:
> NX Report complete - copy this into the issue template
Node : 23.4.0
OS : macOS
npm : 9.8.0
nx : 20.3.0
@nrwl/js : 20.3.0
@nrwl/node : 20.3.0
@nx/esbuild : 20.3.0
Clone the repository and checkout the night-owl-server branch:
git clone https://github.com/Lamar1806/Ikigai.git
cd Ikigai
git checkout night-owl-server
Install dependencies:
npm install
Build the application:
nx build night-owl-server
Verify that the build generates the main.js file in the correct directory:
ls dist/apps/night-owl-server
Serve the application:
nx serve night-owl-server --verbose
Observe the error:
[ watch ] build succeeded, watching for changes...
/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
^
Error: Could not find /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/dist/apps/night-owl-server/main.js. Make sure your build succeeded.
> nx run night-owl-server:serve:development
[ watch ] build succeeded, watching for changes...
/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
^
Error: Could not find /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/dist/apps/night-owl-server/main.js. Make sure your build succeeded.
at fileToRunCorrectPath (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:312:11)
at /Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:98:49
at new Promise (<anonymous>)
at Object.start (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:92:36)
at async Timeout.processQueue [as _onTimeout] (/Users/dalmarsegrest-brooks/Documents/Code.nosync/Ikigai/node_modules/@nx/js/src/executors/node/node.impl.js:63:13)
Node.js v23.4.0
Lamar1806
changed the title
NX Serve Fails to Locate Main.js in Freshly Generated Node Application (v20.3)
NX/Node Generates Broken Applications: Serve Fails to Locate Main.js (v20.3)
Dec 28, 2024
Current Behavior
Current Behavior
The
nx build
command works and generates the necessary output files in the expected directory. However, running thenx serve
command fails with the following error:The
main.js
file exists in thedist/apps/night-owl-server
directory after running the build command, but the serve command is unable to locate it.Expected Behavior
The
nx serve
command should:nx build
command to generate the necessary files.main.js
file in thedist/apps/night-owl-server
directory and execute it.This behavior is expected for a newly generated Node.js application.
Steps to Reproduce
Clone the repository and checkout the
night-owl-server
branch:git clone https://github.com/Lamar1806/Ikigai.git cd Ikigai git checkout night-owl-server
Install dependencies:
Build the application:
Verify that the build generates the
main.js
file in the correct directory:Serve the application:
Observe the error:
Failure Logs / Images / Videos
Error Logs:
Environment
nx report
Output:Additional Notes
This issue can be reproduced by cloning the branch at this link:
https://github.com/Lamar1806/Ikigai/tree/night-owl-server
After cloning, install dependencies, build, and run the
serve
command as described above.Expected Behavior
Explained above
GitHub Repo
https://github.com/Lamar1806/Ikigai/tree/night-owl-server
Steps to Reproduce
Steps to Reproduce
Clone the repository and checkout the
night-owl-server
branch:git clone https://github.com/Lamar1806/Ikigai.git cd Ikigai git checkout night-owl-server
Install dependencies:
Build the application:
Verify that the build generates the
main.js
file in the correct directory:Serve the application:
Observe the error:
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
This issue can be reproduced by cloning the branch at this link:
https://github.com/Lamar1806/Ikigai/tree/night-owl-server
After cloning, install dependencies, build, and run the
serve
command as described above.The text was updated successfully, but these errors were encountered: