temando / serverless-openapi-documentation

Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration
MIT License
93 stars 127 forks source link

Install module in node docker image #38

Open eskimoquinn opened 5 years ago

eskimoquinn commented 5 years ago

I am trying to install this plugin in a node docker image (v.10.10.0). However, after npm install, serverless says that this plugin could not be found and indeed the dist folder is missing from the node modules directory. Does this module have dependencies on bash?

kzhou57 commented 5 years ago

What's in your package.json? Could be a npm version issue.

eskimoquinn commented 5 years ago
{
  "name": "lambda-serverless-node-template",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "SERVERLESS_STAGE=test jest",
    "test:offline": "SERVERLESS_STAGE=test IS_OFFLINE=true jest",
    "test:watch": "jest --watch",
    "build": "serverless webpack",
    "preDeploy": "npm run test",
    "deploy": "sls deploy",
    "generateSwagger:test": "export LAMBDA_URL=$(npx serverless info --verbose --stage=test | grep ServiceEndpoint | sed s/ServiceEndpoint\\:\\ //g) && sls openapi generate --stage test --format json",
},
"devDependencies": {
    "@pact-foundation/pact": "^8.2.2",
    "@types/jest": "^24.0.12",
    "@babel/core": "7.2.2",
    "@babel/preset-env": "^7.3.1",
    "babel-core": "^7.0.0-bridge.0",
    "@babel/plugin-proposal-class-properties": "^7.3.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.3.1",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^23.6.0",
    "babel-loader": "^8.0.5",
    "babel-plugin-source-map-support": "^2.0.1",
    "babel-upgrade": "0.0.24",
    "eslint": "^5.13.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-config-prettier": "^4.0.0",
    "eslint-plugin-babel": "^5.3.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jsx-a11y": "^6.2.0",
    "eslint-plugin-react": "^7.11.1",
    "jest": "^23.6.0",
    "npm-check": "^5.9.0",
    "prettier": "^1.16.4",
    "serverless": "1.36.3",
    "serverless-aws-documentation": "1.1.0",
    "serverless-offline": "^4.2.1",
    "serverless-plugin-tracing": "^2.0.0",
    "serverless-pseudo-parameters": "^2.4.0",
    "@anttiviljami/serverless-stack-output": "^0.3.1",
    "serverless-webpack": "^5.2.0",
    "serverless-openapi-documentation": "github:kzhou57/serverless-openapi-documentation",
    "superagent": "^4.1.0",
    "webpack": "^4.27.1",
    "webpack-node-externals": "^1.7.2"
  }
}
eskimoquinn commented 5 years ago

I am using npm version 6.4.1.

eskimoquinn commented 5 years ago

And also I am using node:10.15.3-jessie as a base image in my docker file.

kzhou57 commented 5 years ago

@eskimoquinn , it's an known issue, my fix ("github:kzhou57/serverless-openapi-documentation"), cannot be submit to npm repository yet, so we are using the github as the repository, and I am using a new feature from npm to support compile the package on place, unfortunately the compilation of serverless-openapi-documentation need another program called 'yarn'.

You probably can add following command to your docker file, it should solve the problem :

npm install yarn

Since it sounds like troublesome to use the compiling in place feature, I am thinking to just commit the compiled dist folder to github repo.