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

Permission denied #833

Closed
kklark opened this issue Sep 16, 2020 · 10 comments
Closed

Permission denied #833

kklark opened this issue Sep 16, 2020 · 10 comments

Comments

@kklark
Copy link

kklark commented Sep 16, 2020

Hi there,
After successful app build getting this error in the Caprover console.

2020-09-16T10:06:40.943555018Z > pleach@1.0.0 start /usr/src/app
2020-09-16T10:06:40.943571497Z > ./index.js
2020-09-16T10:06:40.943575855Z 
2020-09-16T10:06:40.951685429Z sh: ./index.js: Permission denied
2020-09-16T10:06:40.956050476Z npm ERR! code ELIFECYCLE
2020-09-16T10:06:40.957261052Z npm ERR! errno 126
2020-09-16T10:06:40.959403506Z npm ERR! pleach@1.0.0 start: `./index.js`
2020-09-16T10:06:40.959909379Z npm ERR! Exit status 126
2020-09-16T10:06:40.960768422Z npm ERR! 
2020-09-16T10:06:40.961574972Z npm ERR! Failed at the pleach@1.0.0 start script.
2020-09-16T10:06:40.962142555Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-09-16T10:06:40.968154124Z 
2020-09-16T10:06:40.969087872Z npm ERR! A complete log of this run can be found in:
2020-09-16T10:06:40.969619416Z npm ERR!     /root/.npm/_logs/2020-09-16T10_06_40_964Z-debug.log

__
Environment:
Debian 10x64
Fresh Caprover setup

I'd appreciate any help.

@githubsaturn
Copy link
Collaborator

This looks like it's not a CapRover bug. It's related to your own application, right?

@githubsaturn
Copy link
Collaborator

Can you share the Dockerfile?

@kklark
Copy link
Author

kklark commented Sep 16, 2020

Perhaps. But it's not completely clear. :) Everything works locally. There is no Dockerfile. This is a node js app, I deployed it from tar and also github.

@kklark
Copy link
Author

kklark commented Sep 16, 2020

By the way, it is successfully deployed on Heroku in the same configuration.

@kklark
Copy link
Author

kklark commented Sep 16, 2020

I wonder why it doesn't work in Caprover?

@kklark
Copy link
Author

kklark commented Sep 16, 2020

Just found Dockerfile of the app:

/usr/src/app # cat Dockerfile 

FROM library/node:10.5.0-alpine


RUN apk update && apk upgrade && \
    apk add --no-cache git
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY ./package.json /usr/src/app/
RUN npm install --production && npm cache clean --force
COPY ./ /usr/src/app
ENV NODE_ENV production
ENV PORT 80
EXPOSE 80

CMD [ "npm", "start" ]

@githubsaturn
Copy link
Collaborator

githubsaturn commented Sep 16, 2020

I think the issue is with your "start" operation in your package.json file. Can you share what it is?

By the looks of your error I assume it's "./index.js", it should be "node index.js"

@kklark
Copy link
Author

kklark commented Sep 17, 2020

Sure,
...

{
  "name": "pleach",
  "version": "1.0.0",
  "private": true,
  "description": "",
  "main": "index.js",
  "engines": {
    "node": ">=10.5.0"
  },
  "scripts": {
    "test": "nyc mocha",
    "start": "./index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "archiver": "^4.0.1",
    "aws-sdk": "^2.750.0",
    "compression": "^1.7.4",
    "cookie-parser": "^1.4.5",
    "cors": "^2.8.5",
    "debug": "^4.1.1",
    "ejs": "^3.1.5",
    "express": "^4.17.1",
    "express-end": "0.0.8",
    "express-fileupload": "^1.2.0",
    "express-session": "^1.17.1",
    "express-socket.io-session": "^1.3.5",
    "follow-redirects": "^1.13.0",
    "fs-extra": "^9.0.0",
    "knex": "^0.21.5",
    "mime-types": "^2.1.27",
    "mssql": "^6.2.0",
    "mysql": "^2.18.1",
    "mysql2": "^2.1.0",
    "node-schedule": "^1.3.2",
    "nodemailer": "^6.4.6",
    "nodemon": "^2.0.4",
    "pg": "^8.3.3",
    "qs": "^6.9.4",
    "sharp": "^0.25.3",
    "socket.io": "^2.3.0",
    "sqlite3": "^4.2.0",
    "unzipper": "^0.10.11",
    "uuid": "^8.0.0"
  },
  "devDependencies": {
    "mocha": "^7.1.2",
    "nyc": "^15.0.1",
    "supertest": "^4.0.2"
  },
  "nodemonConfig": {
    "watch": [
      "app",
      "lib",
      "views",
      "tmp/**/restart.txt"
    ],
    "ext": "ejs,js,json"
  }
}

@githubsaturn
Copy link
Collaborator

So yea, just change "start": "./index.js" to "start": "node index.js" and it'll be fine.

@kklark
Copy link
Author

kklark commented Sep 17, 2020

It helped! 👍
Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants