npm run start:prod is failed, unnecessary modules required (newly created project) v5
See original GitHub issueI’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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:18 (4 by maintainers)
Top Results From Across the Web
'npm start' returns error: "There might be a problem with the ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >How to deploy a TS Node.js app in minutes - Medium
First Steps: · npm run tsc will compile your application according to the configurations in the tsconfig.json file and create a build folder...
Read more >Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >protobufjs - npm
Start using protobufjs in your project by running `npm i protobufjs`. There are 2888 other projects in the npm registry using protobufjs.
Read more >40 Useful NPM Packages for Node.js Apps in 2021 - LeanyLabs
Long ago, software engineers realized they could significantly speed up the development process by eliminating the need to write repetitive code in every ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 youdist
directory.It must have been an idea for an April fools’ day prank. 🤔
Just call
node dist/main.js
directly.Just for someone else experimenting this issue, my workaround was to modify the path of main.js :