Closed GreensterRox closed 6 years ago
The issue turned out to be a stray node_modules
directory on the server (we normally use node_modules_production
).
Two things I've learned from this:
1.) node_modules
is used instead of node_module_production
if it exists. My RPM was not overwriting the directory and hence left an old copy of node_modules
which was incorrectly packaged up at some point. The swagger app was loading modules from node_modules
and not node_modules_production
2.) swagger_params_parser is indeed missing, even on the working version of the code so it looks like this error:
Error initializing middleware
May 22 13:25:27 myserver "myapp": Error: Cannot find module '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser
is misleading, as that module is never present, at least in version 0.7.0 of swagger-connect
Thanks for the update!
I've now upgraded to swagger-connect 0.7.0 using the manual instructions which included adding the following to config/default.yml:
and under section 'swagger_controllers:' I've added :
- swagger_params_parser
This works gloriously on my local machine but when I push to the server it throws the error:
I'm starting the server via:
node app.js
So it looks like a potential dependency bleed on my local machine but I've destroyed (rm -Rf) 'node_modules' and re-run npm install and it still works fine on my local machine but breaks on the server.
Any ideas why swagger-params-parser is missing?
Also, another weird thing is that swagger-params-parser doesn't exist locally in directory '
/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser
' and yet locally it works!?