| Summary: | npm modules installed on a nodejs application are not displayed | ||
|---|---|---|---|
| Product: | OpenShift Online | Reporter: | Nikhil Mone <nmone> |
| Component: | Image | Assignee: | Ben Parees <bparees> |
| Status: | CLOSED CANTFIX | QA Contact: | libra bugs <libra-bugs> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 2.x | CC: | agoldste, bparees, nmone, zhewang |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1031718 | Environment: | |
| Last Closed: | 2014-01-23 14:48:42 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | 1031718 | ||
| Bug Blocks: | 1031723 | ||
|
Description
Nikhil Mone
2013-11-18 15:45:27 UTC
I think the root cause is that node packages are installed under $OPENSHIFT_REPO_DIR/node_modules/ rather than $OPENSHIFT_DEPENDENCIES_DIR/node_modules , but $OPENSHIFT_HOMEDIR/.node_modules (incorrectly?) links to $OPENSHIFT_DEPENDENCIES_DIR/node_modules. Hence, the installed packages will not be displayed when sourcing under $OPENSHIFT_HOMEDIR.
Here is the debugging to support my stand:
1. install the following dependencies:
"dependencies": {
"yo": "1.x.x",
"compass": "0.x",
"bower": "1.x"
},
during the installation, we can see from the console that the packages are installed under $OPENSHIFT_REPO_DIR/node_modules/ e.g.,
remote: npm info build /var/lib/openshift/528c1d63ebf58c2441000007/app-root/runtime/repo/node_modules/yo
2. when checking the installed packages under $OPENSHIFT_DEPENDENCIES_DIR/node_modules, we can see that the packages are present under this dir, but $OPENSHIFT_HOMEDIR/.node_modules is linked to it.
lrwxrwxrwx. 1 528c2105ebf58c244100002a 528c2105ebf58c244100002a 78 Nov 19 21:40 .npm -> /var/lib/openshift/528c2105ebf58c244100002a/app-root/runtime/dependencies/.npm
3. sourcing node packages under $OPENSHIFT_HOMEDIR will return an empty list as this bug described.
4. sourcing node packages under $OPENSHIFT_REPO_DIR/ will return the installed packages, for example,
[njs-dev4051tst.dev.rhcloud.com repo]\> npm ls | grep yo
└─┬ yo.4
I am not sure if the different behaviours between $OPENSHIFT_DEPENDENCIES_DIR/node_modules and $OPENSHIFT_REPO_DIR/node_modules are by design, and I would appreciate a lot if you could help to make it clear.
Sorry, in step 2, it should be "we can see that the packages are NOT present under this dir, but $OPENSHIFT_HOMEDIR/.node_modules is linked to it" As best I can tell, this has always been the behavior. I tested on a devenv based on stage_528 (which was before we had $OPENSHIFT_DEPENDENCIES_DIR), and running "npm ls" from the home directory of the gear returns 0 modules, even if you have some installed. If you cd into app-root/runtime/repo and run "npm ls" it will display whatever modules you have installed. We can create a Trello card if you'd like for trying to install application npm modules into $OPENSHIFT_DEPENDENCIES_DIR/nodejs/node_modules instead of app-root/runtime/repo/node_modules, but I'm not sure of the feasibility and/or implications of doing that. I do not think this is ever going to work as the reporter desires since npm will only report modules installed under the working directory, and rhc ssh will never take you to either the app-root or the dependencies directory, which are the two places the modules can be installed. *** Bug 1031718 has been marked as a duplicate of this bug. *** |