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

Add support for production mode install #59

Closed
panki opened this issue Dec 1, 2019 · 7 comments · Fixed by #65
Closed

Add support for production mode install #59

panki opened this issue Dec 1, 2019 · 7 comments · Fixed by #65

Comments

@panki
Copy link

panki commented Dec 1, 2019

At the moment, the library cannot be installed in production mode (i.e. yarn install --production), cause almost all required dependencies are in devDependencies section.

@Rmannn
Copy link
Member

Rmannn commented Dec 2, 2019

Could you be more precise about the error you have please ?
This package is installed using production on many projects.

Required dependencies are listed in peer dependencies cause they are required at an higher level in your application.
Dev dependencies are just here to recreate a complete app environment during dev.
ex.
Commander is required by @nestjs/cli, commander is a peer dependency
rxjs is required by nestjs/core, same result
nestjs/common should be installed at root of you app, it's also a peer dependency.

Before to install in production mode you have to install peer deps (and framework deps too) Once peer dependencies are installed, you can install it using production.

This is not a standalone package, and it is supposed to work in a pre existing environement. That means any application that already have installed nestjs core, common and the commander packages.

@Rmannn
Copy link
Member

Rmannn commented Dec 2, 2019

Maybe I should add the install workflow in the documentation but it's something that is very common in a lot of NPM packages.

During development of your app

  1. yarn add nestjs-console
  2. look for missing required peer dependencies.
  3. install missing peer dependencies.

Then during production deployment, you could install using a yarn install --production

@panki
Copy link
Author

panki commented Dec 2, 2019

If I do yarn install --production, I get following error trying run my console app:

/app # node dist/console.js
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'lodash'
Require stack:
- /app/node_modules/nestjs-console/lib/scanner.js
- /app/node_modules/nestjs-console/lib/module.js
- /app/node_modules/nestjs-console/lib/bootstrap.js
- /app/node_modules/nestjs-console/lib/index.js
- /app/dist/console.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/app/node_modules/nestjs-console/lib/scanner.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/app/node_modules/nestjs-console/lib/scanner.js',
    '/app/node_modules/nestjs-console/lib/module.js',
    '/app/node_modules/nestjs-console/lib/bootstrap.js',
    '/app/node_modules/nestjs-console/lib/index.js',
    '/app/dist/console.js'
  ]
}

Is it helpful? do yo need my package.json or yarn.lock?

@Rmannn
Copy link
Member

Rmannn commented Dec 2, 2019

Ok, lodash is missing in dependencies.
This was already fixed in the v2 branch that is going to be published on npm this week asap. (tests in progress)
We didn't see this issue in the past.
Thank you for the report.

@panki
Copy link
Author

panki commented Dec 3, 2019

Ok, great!

@panki
Copy link
Author

panki commented Dec 25, 2019

Any news about v2?

@Rmannn
Copy link
Member

Rmannn commented Jan 1, 2020

Could you try the nestjs-console@next version from npm ?

Rmannn added a commit that referenced this issue Jan 3, 2020
v1.2.1
v1.2.1

-  Fix #61 a type error during the bootstrap scan for decorators
-  Fix #59 Remove implicit lodash dependency
-  Fix #58 Update to support commander@^4 #58
Rmannn added a commit that referenced this issue Jan 3, 2020
-  Fix #61 a type error during the bootstrap scan for decorators
-  Fix #59 Remove implicit lodash dependency
-  Fix #58 Update to support commander@^4 #58
@Rmannn Rmannn mentioned this issue Jan 3, 2020
@Rmannn Rmannn closed this as completed in #65 Jan 3, 2020
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

Successfully merging a pull request may close this issue.

2 participants