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

npm run start:prod is failed, unnecessary modules required (newly created project) v5 #594

Closed
VMois opened this issue Apr 23, 2018 · 17 comments

Comments

@VMois
Copy link

commented Apr 23, 2018

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

After setting up a project with CLI as described in docs (without changing code), I have tried to run a command 'npm run start:prod' and get this error:

> test@0.0.1 prestart:prod /home/vmois/Projects/Portal/test
> rm -rf dist && tsc

node_modules/@nestjs/common/interfaces/microservices/microservice-configuration.interface.d.ts(3,32): error TS2307: Cannot find module 'mqtt'.
node_modules/@nestjs/common/interfaces/microservices/microservice-configuration.interface.d.ts(4,35): error TS2307: Cannot find module 'grpc'.

npm ERR! Linux 3.16.0-5-amd64
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "run" "start:prod"
npm ERR! node v8.4.0
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! test@0.0.1 prestart:prod: `rm -rf dist && tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the test@0.0.1 prestart:prod script 'rm -rf dist && tsc'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     rm -rf dist && tsc
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls test
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vmois/Projects/Portal/test/npm-debug.log

Of course the easiest solution is to install these packages, but what if I don't use them and don't want to install. Thanks.

Expected behavior

Compile and server in dist/main.js

Minimal reproduction of the problem with instructions

Try to setup up project with CLI, and then run 'npm run start:prod'

Environment


[Nest Information]
microservices version : 5.0.0-beta.3
websockets version    : 5.0.0-beta.3
testing version       : 5.0.0-beta.3
common version        : 5.0.0-beta.3
core version          : 5.0.0-beta.3

 
For Tooling issues:
- Node version: 8.4.0
- Platform: Linux

Others:
Package manager: yarn
@sgomanf

This comment has been minimized.

Copy link

commented Apr 23, 2018

same issue

@VMois

This comment has been minimized.

Copy link
Author

commented Apr 24, 2018

npm run start:prod command works in NestJS v4.5.9, so I think it is an issue related to v5.

@VMois VMois changed the title npm run start:prod is failed after CLI new project setup npm run start:prod is failed, unnecessary modules required (newly create project) v5 Apr 24, 2018

@VMois VMois changed the title npm run start:prod is failed, unnecessary modules required (newly create project) v5 npm run start:prod is failed, unnecessary modules required (newly created project) v5 Apr 24, 2018

@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

This issue comes from Nest v5.0.0. Thanks for reporting!

@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Apr 28, 2018

Fixed in v5.0.0-beta.4. Let me know if you face any issue. 🙂

@sgomanf

This comment has been minimized.

Copy link

commented Apr 29, 2018

It works thanks

@robertmain

This comment has been minimized.

Copy link

commented Jul 8, 2018

I'm having this issue with 5.1.0

@arfaWong

This comment has been minimized.

Copy link

commented Oct 26, 2018

same issue with 5.1.0.

@moltar

This comment has been minimized.

Copy link

commented Nov 5, 2018

Same here!

@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Nov 5, 2018

I would recommend updating your packages to 5.4.0, there were no breaking changes.

@moltar

This comment has been minimized.

Copy link

commented Nov 6, 2018

Updated to 5.4.0, but still experiencing this issue.

@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Nov 6, 2018

The issue is definitely not present in 5.4.0. Please, ensure that all packages were updated. If you prefer, you can create a dedicated issue on StackOverflow.

@kumanan12

This comment has been minimized.

Copy link

commented Dec 17, 2018

I am still seeing the same issue mentioned above. Its very easy to reproduce. I am running 5.4 version.

Just create a project and run "npm run start:prod"

@y12studio

This comment has been minimized.

Copy link

commented Jan 7, 2019

Just for someone else experimenting this issue, my workaround was to modify the path of main.js :

sed -i.bak 's|dist/main.js|dist/src/main.js|g' package.json
@baddlan

This comment has been minimized.

Copy link

commented Feb 13, 2019

If you happen to build your project in a Docker container and then run it in a different one for use in production, then don't use npm run start:prod because it counter-intuitively deletes you dist directory.

It must have been an idea for an April fools' day prank. 🤔

Just call node dist/main.js directly.

@robertmain

This comment has been minimized.

Copy link

commented Feb 14, 2019

The idea is to clean the built assets out before building new ones. This is to ensure you aren't running old code

@nigelvon

This comment has been minimized.

Copy link

commented Jul 4, 2019

Same issue with v6.4.1

@MarluanEspiritusanto

This comment has been minimized.

Copy link

commented Jul 18, 2019

If you happen to build your project in a Docker container and then run it in a different one for use in production, then don't use npm run start:prod because it counter-intuitively deletes you dist directory.

It must have been an idea for an April fools' day prank. 🤔

Just call node dist/main.js directly.

It works for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.