Please answer the following questions for yourself before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.
I build a production build of my node app, which is generated from @nrwl/node, calling nx build api --prod. I copy the generated files onto my server (or just another directory) and start it with node main.js.
The error I get when starting is:
> node main.js
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'tslib'
Require stack:
- C:\Users\vinca\Desktop\main.js
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)[39m
[90m at Module.require (internal/modules/cjs/loader.js:852:19)[39m
[90m at require (internal/modules/cjs/helpers.js:74:18)[39m
at Object.<anonymous> (C:\Users\vinca\Desktop\main.js:91:18)
at __webpack_require__ (C:\Users\vinca\Desktop\main.js:20:30)
at Object.<anonymous> (C:\Users\vinca\Desktop\main.js:1086:17)
at __webpack_require__ (C:\Users\vinca\Desktop\main.js:20:30)
at Object.<anonymous> (C:\Users\vinca\Desktop\main.js:1076:18)
at __webpack_require__ (C:\Users\vinca\Desktop\main.js:20:30) {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: [ [32m'C:\\Users\\vinca\\Desktop\\main.js'[39m ]
}
I sense this is because api build does not include vendors. Is there a configuration option I'm missing?
I added this flag in production build config: "externalDependencies": "none"
@vincaslt , thank you, it helped! I would never guess it...
Most helpful comment
I added this flag in production build config:
"externalDependencies": "none"