Bug 1178029

Summary: module does not work due dangling symlink
Product: [Fedora] Fedora Reporter: Miroslav Suchý <msuchy>
Component: nodejs-momentAssignee: Nobody's working on this, feel free to take it <nobody>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: urgent    
Version: rawhideCC: tchollingsworth
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nodejs-moment-2.8.3-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-17 05:37:17 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:
Embargoed:

Description Miroslav Suchý 2015-01-01 16:14:01 UTC
Description of problem:
Module could not be loaded. This is because of incorrect symlink:

$ ls -l /usr/lib/node_modules/moment/moment.js
lrwxrwxrwx. 1 root root 31 Nov  3 20:09 /usr/lib/node_modules/moment/moment.js -> /usr/share/javascript/moment.js
$ ls -l /usr/share/javascript/moment.js
ls: cannot access /usr/share/javascript/moment.js: No such file or directory

but

$ ls -l /usr/share/javascript/moment/moment.js
-rw-r--r--. 1 root root 92743 Sep  5 09:58 /usr/share/javascript/moment/moment.js


Version-Release number of selected component (if applicable):
nodejs-moment-2.8.3-1.fc21.noarch
js-moment-2.8.3-1.fc21.noarch

How reproducible:
always

Steps to Reproduce:
1. echo "var moment = require('moment');" > /tmp/m.js
2. node /tmp/m.js 

Actual results:
module.js:340
    throw err;
          ^
Error: Cannot find module 'moment'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/tmp/m.js:1:76)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Expected results:
No errors

Comment 1 Miroslav Suchý 2015-01-01 16:22:15 UTC
/usr/lib/node_modules/moment/{locale,min} are dangling symlink as well:

lrwxrwxrwx. 1 root root   28 Nov  3 20:09 locale -> /usr/share/javascript/locale
lrwxrwxrwx. 1 root root   25 Nov  3 20:09 min -> /usr/share/javascript/min

Should be symlinked against:
 /usr/share/javascript/moment/{locale,min}

Hmm, but even if I manually fix the symlink it still does not work. :(

Comment 2 Fedora Update System 2015-01-02 11:27:45 UTC
nodejs-moment-2.8.3-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/nodejs-moment-2.8.3-2.fc21

Comment 3 Jamie Nguyen 2015-01-02 11:31:08 UTC
Sorry about this :(

Above update should fix it.

By the way, you can't require modules without explicitly linking them, which is why you are seeing the module error:
https://fedoraproject.org/wiki/Node.js#Using_modules_installed_via_yum

Comment 4 Fedora Update System 2015-01-03 19:05:43 UTC
Package nodejs-moment-2.8.3-2.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nodejs-moment-2.8.3-2.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0076/nodejs-moment-2.8.3-2.fc21
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2015-01-17 05:37:17 UTC
nodejs-moment-2.8.3-2.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.