csantanapr opened a new issue #58: can't override npm packages that are 
embedded when extending runtime image.
URL: https://github.com/apache/incubator-openwhisk-runtime-nodejs/issues/58
 
 
   Given that I have a `package.json` that I want to use to extend the nodejs 
runtime
   Let's say I want to use a different version of npm package `openwhisk` and 
some of my own.
   
   package.json:
   ```json
   {
     "dependencies": {
       "cowsay": "^1.3.0",
       "openwhisk": "2.0.0"
     }
   }
   ```
   I have the following `Dockerfile`
   ```dockerfile
   FROM openwhisk/action-nodejs-v8
   COPY package.json .
   RUN npm i --production
   ```
   Running this will not work. This is how I want it to work.
   This will wipe the already present `/nodejsAction/node_modules` directory 
and install my new npm packages `openwhisk` and `cowsay`
   
   A 1/2 workaround is to install my dependcies in the parent directory of 
`/nodejsAction/` which `/`
   This way nodejs ref [1] will not find it in `/nodejsAction/tmpXX` or 
`/nodejsAction/` and fall back to `/`
   ```dockerfile 
   FROM openwhisk/action-nodejs-v8
   COPY package.json /
   RUN cd / && npm i --production
   ```
   
   This 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`
   
   My 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.
   
   cc @rabbah 
   
   [1]: 
https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to