nodeshift-archived / centos7-s2i-nodejs

DEPRECATED OpenShift S2I builder images for Node.js ✨
Apache License 2.0
33 stars 55 forks source link

Investigate and resolve npm warnings on image install #9

Closed lance closed 7 years ago

lance commented 7 years ago
I0531 17:35:30.905920       1 sti.go:660] ┌───────────────────────────────────────────────────────────────┐
I0531 17:35:30.905932       1 sti.go:660] │                    npm update check failed                    │
I0531 17:35:30.905940       1 sti.go:660] │              Try running with sudo or get access              │
I0531 17:35:30.905951       1 sti.go:660] │             to the local update config store via              │
I0531 17:35:30.905957       1 sti.go:660] │ sudo chown -R $USER:$(id -gn $USER) /opt/app-root/src/.config │
I0531 17:35:30.905965       1 sti.go:660] └───────────────────────────────────────────────────────────────┘
david-martin commented 7 years ago

@lance I'm seeing this output a few times, then a failure (exit code 13). Maybe this output is unrelated to the failure? There is an npm proxy, which works with previous versions, but I won't rule that out as a cause of this failure. I'll see if I can get it past this step either way.

Cloning "https://github.com/feedhenry-templates/helloworld-cloud" ...
    Commit: 904aa80bf4e92b629ad2e7ae4ad75a4f6e833681 (Merge branch update-mbaas-api-7.0.9)
    Author: Wei Li <wei.li@redhat.com>
    Date:   Tue May 16 15:38:04 2017 +0100
Using HTTP proxy http://XXXXXXXXXX@XXXXXXXXXXX:3128 and HTTPS proxy http://XXXXXXXXXX@XXXXXXXXXXX:3128 for script download
---> Installing application source
---> Setting npm http proxy to http://XXXXXXXXXX@XXXXXXXXXXX:3128
npm info it worked if it ends with ok
npm info using npm@5.0.0
npm info using node@v8.0.0
npm info config set "proxy" "http://XXXXXXXXXX@XXXXXXXXXXX:3128"
┌───────────────────────────────────────────────────────────────┐
│                    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 info ok 
---> Setting npm https proxy to http://XXXXXXXXXX@XXXXXXXXXXX:3128
npm info it worked if it ends with ok
npm info using npm@5.0.0
npm info using node@v8.0.0
npm info config set "https-proxy" "http://XXXXXXXXXX@XXXXXXXXXXX:3128"
┌───────────────────────────────────────────────────────────────┐
│                    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 info ok 
---> Building your Node application from source
---> Using 'npm install'
┌───────────────────────────────────────────────────────────────┐
│                    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 │
└───────────────────────────────────────────────────────────────┘
error: build error: non-zero (13) exit code from docker.io/bucharestgold/centos7-s2i-nodejs:8.x
david-martin commented 7 years ago

The 6.x tag is working OK (above was with the 8.x tag) with the same repo & npm proxy. https://gist.github.com/david-martin/552526cd7a01b34de8844c04b7504c1c

david-martin commented 7 years ago

An update on my problem. It looks like an npm proxy issue, not related to the npm update warnings. Output with silly logging can be seen here https://gist.github.com/david-martin/2ebfa60608913b9269f7c3ebc9f74b51 Its getting 407 errors for every package. Interesting that it works ok for with node 6.x, so maybe an npm change.

EDIT: Its an npm auth proxy issue that is fixed in 5.0.1 https://github.com/npm/npm/releases/tag/v5.0.1

david-martin commented 7 years ago

@lance Getting back to the issue at hand, here's the error & stack when that warning is being output (I added some extra logging to see it)

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                           Error: EACCES: permission denied, open '/opt/app-root/src/.config/configstore/update-notifier-npm.json'                           │
│                                                             You don't have access to this file.                                                             │
│                           Error: EACCES: permission denied, open '/opt/app-root/src/.config/configstore/update-notifier-npm.json'                           │
│                                                             You don't have access to this file.                                                             │
│                                                                                                                                                             │
│                                                              at Object.fs.openSync (fs.js:638:18)                                                           │
│                                                            at Object.fs.readFileSync (fs.js:540:33)                                                         │
│    at Configstore.get all [as all] (/opt/app-root/src/.npm-global/lib/node_modules/npm/node_modules/update-notifier/node_modules/configstore/index.js:29:25)│
│          at new Configstore (/opt/app-root/src/.npm-global/lib/node_modules/npm/node_modules/update-notifier/node_modules/configstore/index.js:25:46)       │
│                     at new UpdateNotifier (/opt/app-root/src/.npm-global/lib/node_modules/npm/node_modules/update-notifier/index.js:41:19)                  │
│                   at module.exports.options (/opt/app-root/src/.npm-global/lib/node_modules/npm/node_modules/update-notifier/index.js:143:25)               │
│                                            at /opt/app-root/src/.npm-global/lib/node_modules/npm/bin/npm-cli.js:31:5                                        │
│                                 at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/npm/bin/npm-cli.js:92:3)                              │
│                                                              at Module._compile (module.js:569:30)                                                          │
│                                          at Object.Module._extensions..js (module.js:580:10) 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                                                │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Its being output from here in the update-notifier module, which npm uses to check if it's up to date. https://github.com/yeoman/update-notifier/blob/master/index.js#L40-L59 Related issue in that lib https://github.com/yeoman/update-notifier/issues/109

If we change perms to 777 on /opt/app-root/src/.config/configstore/update-notifier-npm.json in the install_node.sh script when making the image, it seems to prevent the warning. See https://github.com/bucharest-gold/centos7-s2i-nodejs/pull/11 for potential fix

lance commented 7 years ago

@david-martin I appreciate all your work on this - thanks!