Code Monkey home page Code Monkey logo

Comments (28)

OfekRv avatar OfekRv commented on August 16, 2024 1

Im using openshift with node.js 10
if my NODE_EVN is production than I get this:

  | │ npm update check failed │
  | │ Try running with sudo or get access │
  | │ to the local update config store via │
  | │ sudo chown -R $USER:$(id -gn $USER) /opt/app-root/src/.config │

else, if my NODE_ENV defined as development than I get that:

npm ERR! path /opt/app-root/src/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/opt/app-root/src/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

I played a lot with the pods, builds and etc.. didnt work
https://github.com/NatalyShv/Roomates
this is my POC repo that I try to launch on openshift @lance

from centos7-s2i-nodejs.

lholmquist avatar lholmquist commented on August 16, 2024

@lincolnthree by default, we do a "production" install, which doesn't install devDepencies
If you add NODE_ENV=development to your deploy, it will install dev dependecies during deployment

or move those devDepencies to regular dependencies

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

Hey @lholmquist ! Thanks. I actually just tried that and got a little farther (Yay!), but it's failing to install dependencies because there's no FS access now:

npm ERR! path /opt/app-root/src/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/opt/app-root/src/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/app-root/src/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

Ideas about this one?

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

I see it's already running as root user, so not sure what's happening:

+ echo -e 'Running as user uid=1000140000 gid=0(root) groups=0(root),1000140000'
--
  | + '[' true == true ']'
  | + echo 'Installing dev dependencies...'
  | + npm install

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

Full log:

+ export GIT_COMMITTER_NAME=unknown
+ GIT_COMMITTER_NAME=unknown
+ export and [email protected]
+ [email protected]
+ git --version
git version 2.9.3
+ '[' '' == --debug ']'
+ run_node
+ echo -e 'Environment: \n\tDEV_MODE=true\n\tNODE_ENV=development\n\tDEBUG_PORT=5858'
Environment: 
	DEV_MODE=true
	NODE_ENV=development
	DEBUG_PORT=5858
++ id
+ echo -e 'Running as user uid=1000140000 gid=0(root) groups=0(root),1000140000'
+ '[' true == true ']'
+ echo 'Installing dev dependencies...'
+ npm install
Running as user uid=1000140000 gid=0(root) groups=0(root),1000140000
Installing dev dependencies...
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm http fetch GET 200 https://registry.npmjs.org/rhoaster  170ms
npm http fetch GET 200 https://registry.npmjs.org/nodeshift  180ms
npm http fetch GET 200 https://registry.npmjs.org/openshift-config-loader  52ms
npm http fetch GET 200 https://registry.npmjs.org/openshift-rest-client  53ms
npm http fetch GET 200 https://registry.npmjs.org/yargs  38ms
npm http fetch GET 200 https://registry.npmjs.org/openshift-rest-client/-/openshift-rest-client-1.1.1.tgz  42ms
npm http fetch GET 200 https://registry.npmjs.org/openshift-config-loader  94ms
npm http fetch GET 200 https://registry.npmjs.org/git-repo-info  99ms
npm http fetch GET 200 https://registry.npmjs.org/cliui  50ms
npm http fetch GET 200 https://registry.npmjs.org/js-yaml  116ms
npm http fetch GET 200 https://registry.npmjs.org/find-up  52ms
npm http fetch GET 200 https://registry.npmjs.org/chalk  126ms
npm http fetch GET 200 https://registry.npmjs.org/os-locale  53ms
npm http fetch GET 200 https://registry.npmjs.org/string-width  55ms
npm http fetch GET 200 https://registry.npmjs.org/openshift-rest-client  159ms
npm http fetch GET 200 https://registry.npmjs.org/rimraf  159ms
npm http fetch GET 200 https://registry.npmjs.org/which-module  59ms
npm http fetch GET 200 https://registry.npmjs.org/tar  168ms
npm http fetch GET 200 https://registry.npmjs.org/yargs-parser  65ms
npm http fetch GET 200 https://registry.npmjs.org/strip-ansi  68ms
npm http fetch GET 200 https://registry.npmjs.org/esprima  67ms
npm http fetch GET 304 https://registry.npmjs.org/string-width  81ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/ansi-styles  56ms
npm http fetch GET 200 https://registry.npmjs.org/locate-path  64ms
npm http fetch GET 200 https://registry.npmjs.org/supports-color  55ms
npm http fetch GET 200 https://registry.npmjs.org/execa  52ms
npm http fetch GET 200 https://registry.npmjs.org/mem  64ms
npm http fetch GET 200 https://registry.npmjs.org/is-fullwidth-code-point  64ms
npm http fetch GET 200 https://registry.npmjs.org/fs-minipass  60ms
npm http fetch GET 200 https://registry.npmjs.org/chownr  66ms
npm http fetch GET 200 https://registry.npmjs.org/glob  74ms
npm http fetch GET 200 https://registry.npmjs.org/minipass  70ms
npm http fetch GET 200 https://registry.npmjs.org/safe-buffer  62ms
npm http fetch GET 200 https://registry.npmjs.org/minizlib  68ms
npm http fetch GET 200 https://registry.npmjs.org/yallist  56ms
npm http fetch GET 200 https://registry.npmjs.org/camelcase  49ms
npm http fetch GET 200 https://registry.npmjs.org/p-locate  47ms
npm http fetch GET 200 https://registry.npmjs.org/ansi-regex  55ms
npm http fetch GET 200 https://registry.npmjs.org/has-flag  41ms
npm http fetch GET 200 https://registry.npmjs.org/path-exists  44ms
npm http fetch GET 200 https://registry.npmjs.org/cross-spawn  46ms
npm http fetch GET 200 https://registry.npmjs.org/get-stream  46ms
npm http fetch GET 200 https://registry.npmjs.org/npm-run-path  45ms
npm http fetch GET 200 https://registry.npmjs.org/p-finally  44ms
npm http fetch GET 200 https://registry.npmjs.org/strip-eof  44ms
npm http fetch GET 200 https://registry.npmjs.org/mimic-fn  40ms
npm http fetch GET 200 https://registry.npmjs.org/p-limit  32ms
npm http fetch GET 200 https://registry.npmjs.org/shebang-command  23ms
npm http fetch GET 200 https://registry.npmjs.org/path-key  28ms
npm http fetch GET 200 https://registry.npmjs.org/p-try  22ms
npm http fetch GET 200 https://registry.npmjs.org/shebang-regex  21ms
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it!
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I'll try to do my best with it!
npm WARN checkPermissions Missing write access to /opt/app-root/src/node_modules
npm WARN [email protected] requires a peer of @angular/core@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/router@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path /opt/app-root/src/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/opt/app-root/src/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/opt/app-root/src/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/app-root/src/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
┌───────────────────────────────────────────────────────────────┐
│                    npm update check failed                    │
│              Try running with sudo or get access              │
│             to the local update config store via              │
│ sudo chown -R $USER:$(id -gn $USER) /opt/app-root/src/.config │
└───────────────────────────────────────────────────────────────┘
npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app-root/src/.npm/_logs/2018-05-17T17_57_31_287Z-debug.log

from centos7-s2i-nodejs.

lholmquist avatar lholmquist commented on August 16, 2024

adding in @lance @danbev

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@lincolnthree I have been traveling a bit and will be able to spend more time on this soon, but for now, I have a suspicion about something. If you were to remove all of the artifacts from this project (deployment configs, build configs, builds, image streams, routes and services), then redeploy, does the problem still occur?

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

Trying with a delete.

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

It worked! Thanks @lance . Interesting. Why is this the case?

Also, I hope your talk went well today :)

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

The view at that speaker's dinner looked.... stunning.

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@lincolnthree I haven't looked at your project to see exactly what you are doing, but here is my theory.

When you deploy an application more than once, the assemble script tries to be smart and will use the node_modules directory from previous installs in order to save on deployment time https://github.com/bucharest-gold/centos7-s2i-nodejs/blob/master/s2i/assemble#L42-L49. I think this might be the problem. And in spite of the fact that you are in the root group (look closely at that line, you're not root - just in the group), the permissions from the previous install seem to be insufficient. I will poke around with it more today after my talk and see what I can find.

My first talk yesterday went really well - thanks for asking!

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@lincolnthree since you had success after removing the previous build configuration and other artifacts, does the problem still occur when you try to rebuild?

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

Checking...

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

It fails with the same error. Interesting.

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@lincolnthree I took a look at your package.json and I have to say... that's a complicated build! Can you help me out by explaining how your build works - or even providing a simpler sample project where I can easily reproduce the error within a test case?

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

@lance Yeah I'm simplifying it now. I forked from another project (Fabric8 launcher-frontend). I've been trying to cut out the stuff that's not necessary.

Basically just:

npm install
npm run build:prod
npm run start:prod

"build:prod": "webpack --config config/webpack.prod.js -p",
"start:prod": "node scripts/prod-server.js",

That's all that should be necessary.

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

@lance I'm having some other strange issues now. E.g. the image no longer seems to respect my .s2i/environment file. It's running some other commands and I don't really know what or why.

E.g. It seems to run npm install again in the deployment of the final image. Even after it's already done that during the image build. And it's not calling my NPM_RUN= (I know because I deleted the run script it references and it's still doing the same thing and not complaining.)

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

@lance The s2I image build step just seems to run the npm install and then postinstall scripts. Nothing else.

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

The strange part with that is I could swear it had been respecting this configuration before.

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

Ah. Apparently after reading through the S2I scripts, NPM_RUN is only respected in "production" NODE_ENV... seems like it should be respected in "development" as well?

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@lincolnthree yeah, so in dev mode we run nodemon which looks at the main property in package.json. Can you try adding a main: scripts/prod_server.js line in your package.json to see if that helps?

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@lincolnthree how are things with this?

from centos7-s2i-nodejs.

lincolnthree avatar lincolnthree commented on August 16, 2024

So far so good. I figured out how to use the BuildConfig env: vars to control the node env for build vs. deploy. That seems to be the most reasonable solution. That said, I think there does need to be a way to configure nodemon to target a script in the package.json, not main. As main.js is often used for specifying actual code entry points, not build entry points, right?

I think the conflation of building vs. deploying/releasing should be avoided, as that's already confusing as hell in node-land.

Thoughts?

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

Closing as resolved, and opening a new issue regarding documentation - referencing #94

from centos7-s2i-nodejs.

OfekRv avatar OfekRv commented on August 16, 2024

@lincolnthree I have been traveling a bit and will be able to spend more time on this soon, but for now, I have a suspicion about something. If you were to remove all of the artifacts from this project (deployment configs, build configs, builds, image streams, routes and services), then redeploy, does the problem still occur?

saw this issue and had the same problem (include first step that worked for both of us) but the:
EACCES: permission denied, access '/opt/app-root/src/node_modules' npm openshift
still occures to me, even when I delete it all..

any ideas?
@lance

from centos7-s2i-nodejs.

lance avatar lance commented on August 16, 2024

@OfekRv what version are you using

from centos7-s2i-nodejs.

AuthorProxy avatar AuthorProxy commented on August 16, 2024

the same error as @OfekRv has

from centos7-s2i-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.