Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm link in centos #4933

Closed
hiwanz opened this issue Mar 25, 2014 · 8 comments
Closed

npm link in centos #4933

hiwanz opened this issue Mar 25, 2014 · 8 comments
Labels

Comments

@hiwanz
Copy link

hiwanz commented Mar 25, 2014

i've created my private module under windows,and i tested it use npm link,everything worked fine until i moved this module to centos 5.8,npm link worked fine too,but when i execute this module,it says 'No such file or directory',what is going on.

[root@localhost uechecker-server]# npm link
/usr/local/bin/uechecker-server -> /usr/local/lib/node_modules/uechecker-server/uechecker.js
/usr/local/lib/node_modules/uechecker-server -> /home/ued/uechecker-server
[root@localhost uechecker-server]# uechecker-server
: No such file or directory

@tjwebb
Copy link

tjwebb commented Mar 30, 2014

Looks like your module might be getting executed, and that it's your module that's throwing that error, not your shell. Check output of which uechecker-server.

@hiwanz
Copy link
Author

hiwanz commented Mar 31, 2014

@tjwebb before doing anything else,it would output one message in the console if it was executed,but it didn't,so i don't think that's the problem,any other ideas?

@hiwanz
Copy link
Author

hiwanz commented Mar 31, 2014

[root@localhost attachment]# strace /usr/local/lib/node_modules/uechecker-server/uechecker.js
execve("/usr/local/lib/node_modules/uechecker-server/uechecker.js", ["/usr/local/lib/node_modules/uech"], [/* 33 vars /]) = 0
brk(0) = 0xd1a4000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2adb39af6000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2adb39af7000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=339761, ...}) = 0
mmap(NULL, 339761, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2adb39af8000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\332!\2060\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1726472, ...}) = 0
mmap(0x3086200000, 3506520, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3086200000
mprotect(0x308634f000, 2097152, PROT_NONE) = 0
mmap(0x308654f000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14f000) = 0x308654f000
mmap(0x3086554000, 16728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3086554000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2adb39b4b000
arch_prctl(ARCH_SET_FS, 0x2adb39b4b6e0) = 0
mprotect(0x308654f000, 16384, PROT_READ) = 0
mprotect(0x308601c000, 4096, PROT_READ) = 0
munmap(0x2adb39af8000, 339761) = 0
brk(0) = 0xd1a4000
brk(0xd1c5000) = 0xd1c5000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=56467728, ...}) = 0
mmap(NULL, 56467728, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2adb39b4c000
close(3) = 0
execve("/usr/local/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/opt/17173/jdk/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/opt/17173/jdk/jre/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/opt/17173/jdk/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/lib64/qt-3.3/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/kerberos/sbin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/kerberos/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/local/sbin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/local/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/sbin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/sbin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars /]) = -1 ENOENT (No such file or directory)
execve("/root/bin/node\r", ["node\r", "/usr/local/lib/node_modules/uech"], [/
33 vars */]) = -1 ENOENT (No such file or directory)
write(2, "/usr/bin/env: ", 14/usr/bin/env: ) = 14
) = 5e

i use strace to follow the execute context,and i find node using the wrong module name uech instead of uechecker-server,how could this happen,is it too long to solve the path?

@tjwebb
Copy link

tjwebb commented Mar 31, 2014

I have no idea, but it doesn't look like a problem with the module or npm. Since you installed this globally, I'd try running it with root. Or, don't install it globally. Also try clearing your global and local npm cache directories.

@smikes
Copy link
Contributor

smikes commented Jan 30, 2015

Is this still a problem for you?

It looks to me like the problem is a stray carriage return character (\r) at the end of the first script. This is causing the OS to fail to find the node interpreter; it's looking for "node\r"

Try running fromdos on the text files in your module, or check your git settings if you have used git to check out the code on your linux machine.

There have been a lot of improvements to npm -- especially around conflicts and race conditions during install -- since 1.4. Can you try updating your npm installation?

To update npm, run npm -g install npm@latest

To update npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

For some Linux distributions (Debian/Ubuntu and RedHat/CentOS), the latest node version provided by the distribution may lag behind the stable version. Here are instructions from NodeSource on getting the latest node.

We are trying to clean up older npm issues, so if we don't hear back from you within a week, we will close this issue. (Don't worry -- you can always come back again and open a new issue!)

Thanks!

@hiwanz
Copy link
Author

hiwanz commented Feb 2, 2015

I dont know how could this happened,for the first line of strace,there is not a \r as you can see.

[root@localhost ~]# npm -g install npm@latest
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@2.4.1 /usr/local/lib/node_modules/npm
[root@localhost ~]# strace uechecker-server
execve("/usr/local/bin/uechecker-server", ["uechecker-server"], [/* 33 vars /]) = 0
brk(0) = 0xfcef000
.......
mmap(NULL, 56467728, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2b2ee9290000
close(3) = 0
execve("/usr/local/bin/node\r", ["node\r", "/usr/local/bin/uechecker-server"], [/
33 vars /]) = -1 >ENOENT (No such file or directory)
execve("/opt/17173/jdk/bin/node\r", ["node\r", "/usr/local/bin/uechecker-server"], [/
33 vars */]) = >-1 ENOENT (No such file or directory)>

@smikes
Copy link
Contributor

smikes commented Feb 2, 2015

The \r isn't coming from your command line; it's coming from the file uechecker-server. Try this

$ file /usr/local/bin/uechecker-server
$ cat -v /usr/local/bin/uechecker-server | head 

@hiwanz
Copy link
Author

hiwanz commented Feb 2, 2015

I've solved this by using the following command,and thx for reminding me of that.

[root@localhost uechecker-server]# dos2unix uechecker.js
dos2unix: converting file uechecker.js to UNIX format ...
[root@localhost uechecker-server]# uechecker-server
Analyzing... /home/ued/uechecker-server

@hiwanz hiwanz closed this as completed Feb 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants