{"action":"opened","issue":{"url":"https://api.github.com/repos/apache/incubator-openwhisk-runtime-nodejs/issues/58","repository_url":"https://api.github.com/repos/apache/incubator-openwhisk-runtime-nodejs","labels_url":"https://api.github.com/repos/apache/incubator-openwhisk-runtime-nodejs/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-openwhisk-runtime-nodejs/issues/58/comments","events_url":"https://api.github.com/repos/apache/incubator-openwhisk-runtime-nodejs/issues/58/events","html_url":"https://github.com/apache/incubator-openwhisk-runtime-nodejs/issues/58","id":331284202,"node_id":"MDU6SXNzdWUzMzEyODQyMDI=","number":58,"title":"can't override npm packages that are embedded when extending runtime image.","user":{"login":"csantanapr","id":1094878,"node_id":"MDQ6VXNlcjEwOTQ4Nzg=","avatar_url":"https://avatars0.githubusercontent.com/u/1094878?v=4","gravatar_id":"","url":"https://api.github.com/users/csantanapr","html_url":"https://github.com/csantanapr","followers_url":"https://api.github.com/users/csantanapr/followers","following_url":"https://api.github.com/users/csantanapr/following{/other_user}","gists_url":"https://api.github.com/users/csantanapr/gists{/gist_id}","starred_url":"https://api.github.com/users/csantanapr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csantanapr/subscriptions","organizations_url":"https://api.github.com/users/csantanapr/orgs","repos_url":"https://api.github.com/users/csantanapr/repos","events_url":"https://api.github.com/users/csantanapr/events{/privacy}","received_events_url":"https://api.github.com/users/csantanapr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"csantanapr","id":1094878,"node_id":"MDQ6VXNlcjEwOTQ4Nzg=","avatar_url":"https://avatars0.githubusercontent.com/u/1094878?v=4","gravatar_id":"","url":"https://api.github.com/users/csantanapr","html_url":"https://github.com/csantanapr","followers_url":"https://api.github.com/users/csantanapr/followers","following_url":"https://api.github.com/users/csantanapr/following{/other_user}","gists_url":"https://api.github.com/users/csantanapr/gists{/gist_id}","starred_url":"https://api.github.com/users/csantanapr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csantanapr/subscriptions","organizations_url":"https://api.github.com/users/csantanapr/orgs","repos_url":"https://api.github.com/users/csantanapr/repos","events_url":"https://api.github.com/users/csantanapr/events{/privacy}","received_events_url":"https://api.github.com/users/csantanapr/received_events","type":"User","site_admin":false},"assignees":[{"login":"csantanapr","id":1094878,"node_id":"MDQ6VXNlcjEwOTQ4Nzg=","avatar_url":"https://avatars0.githubusercontent.com/u/1094878?v=4","gravatar_id":"","url":"https://api.github.com/users/csantanapr","html_url":"https://github.com/csantanapr","followers_url":"https://api.github.com/users/csantanapr/followers","following_url":"https://api.github.com/users/csantanapr/following{/other_user}","gists_url":"https://api.github.com/users/csantanapr/gists{/gist_id}","starred_url":"https://api.github.com/users/csantanapr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csantanapr/subscriptions","organizations_url":"https://api.github.com/users/csantanapr/orgs","repos_url":"https://api.github.com/users/csantanapr/repos","events_url":"https://api.github.com/users/csantanapr/events{/privacy}","received_events_url":"https://api.github.com/users/csantanapr/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-06-11T17:41:44Z","updated_at":"2018-06-11T17:41:44Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Given that I have a `package.json` that I want to use to extend the nodejs runtime\r\nLet's say I want to use a different version of npm package `openwhisk` and some of my own.\r\n\r\npackage.json:\r\n```json\r\n{\r\n  \"dependencies\": {\r\n    \"cowsay\": \"^1.3.0\",\r\n    \"openwhisk\": \"2.0.0\"\r\n  }\r\n}\r\n```\r\nI have the following `Dockerfile`\r\n```dockerfile\r\nFROM openwhisk/action-nodejs-v8\r\nCOPY package.json .\r\nRUN npm i --production\r\n```\r\nRunning this will not work. This is how I want it to work.\r\nThis will wipe the already present `/nodejsAction/node_modules` directory and install my new npm packages `openwhisk` and `cowsay`\r\n\r\nA 1/2 workaround is to install my dependcies in the parent directory of `/nodejsAction/` which `/`\r\nThis way nodejs ref [1] will not find it in `/nodejsAction/tmpXX` or `/nodejsAction/` and fall back to `/`\r\n```dockerfile \r\nFROM openwhisk/action-nodejs-v8\r\nCOPY package.json /\r\nRUN cd / && npm i --production\r\n```\r\n\r\nThis will only to find `cowsay` in the `/node_modules` but will find the `1.x` `openwhisk` in `/nodejsAction/node_modules` and never use the version `2.0.0` where I installed it `/node_modules/openwhisk`\r\n\r\nMy proposed solution is that we installed embedded npm packages in in the root `/` this way they act as fallback global modules in the search path, and user is always able to declare the npm packages he wants to use in the action.\r\n\r\ncc @rabbah \r\n\r\n[1]: https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders\r\n"}}
{"actor":{"display_login":"csantanapr"}}