Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Installation failure on Linux when process.execPath is relative #1323

Closed
bobbwal opened this issue Dec 31, 2015 · 22 comments
Closed

Installation failure on Linux when process.execPath is relative #1323

bobbwal opened this issue Dec 31, 2015 · 22 comments

Comments

@bobbwal
Copy link

bobbwal commented Dec 31, 2015

I've been through the troubleshooting but no node-sass/vendor folder is created so that's as far as I can go. Here's my output https://gist.github.com/bobbwal/f4ce61210ff88d9f9f85

Thanks

@bobbwal
Copy link
Author

bobbwal commented Dec 31, 2015

Also the server is running Ash shell, not sure if this could be a problem. I noticed this comment in another issue:
"npm install executes a normal shell and tells it to run node scripts/install.js. If it can't find node (or this is some kind of funky restricted shell), things won't work."

@saper
Copy link
Member

saper commented Jan 1, 2016

bash is by no means mandatory; I am using FreeBSD's /bin/sh without any issues. The shell needs to understand sh -c convention and be able to find node interpreter using PATH environmental variable. What is your SHELL set to? Does /bin/sh -c node invoke your node interpreter? Maybe some shell startup scripts are causing issues (like changing the current directory)?

@bobbwal
Copy link
Author

bobbwal commented Jan 1, 2016

Hi, I'm guessing that command invokes the interpreter, no errors.

$ echo $SHELL
/bin/ash

$ /bin/sh -c node
>

@saper
Copy link
Member

saper commented Jan 1, 2016

@bobbwal is /bin/sh and /bin/ash the same binary? Does it help if you try bash? Is the current directory symlinked?

@bobbwal
Copy link
Author

bobbwal commented Jan 1, 2016

/bin/sh and /bin/ash are identical but I'm not sure what this means. Bash is not installed but I can have a statically compiled bash added on request. The directory is symlinked www -> /www

@saper
Copy link
Member

saper commented Jan 2, 2016

This symlink is interesting - can you elaborate more on the directory structure used? Where is your node_modules directory? Is this some well-known hosting environment (maybe there are public accounts to test and try to reproduce the issue)?

@saper
Copy link
Member

saper commented Jan 2, 2016

What is your process.execPath ?

@saper
Copy link
Member

saper commented Jan 2, 2016

Can you try running the following snippet under your node:

var fs=require('fs'); console.log(process.execPath); console.log(fs.lstatSync(process.execPath)); fs.realpathSync(process.execPath);

@bobbwal
Copy link
Author

bobbwal commented Jan 2, 2016

Here you go:

> var fs=require('fs'); console.log(process.execPath); console.log(fs.lstatSync(process.execPath)); fs.realpathSync(process.execPath);
node
Error: ENOENT: no such file or directory, lstat 'node'
    at Error (native)
    at Object.fs.lstatSync (fs.js:839:18)
    at repl:1:69
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:412:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
>

Directory structure (only included the stuff I thought was relevant):

root
├── bin
├── www
│   └── node_modules
└── home
    ├── .gem
    ├── .npm
    ├── .npmi
    ├── .ssh -> /.ssh
    ├── log -> /log
    └── www -> /www

@saper
Copy link
Member

saper commented Jan 2, 2016

Do you know why your process.execPath is relative? where is your node really located?

@saper saper changed the title Failed install node-sass 3.4.2 | Node 4.2.2 | Linux Installation failure on Linux when process.execPath is relative Jan 2, 2016
@saper
Copy link
Member

saper commented Jan 2, 2016

Do you have /proc filesystem available? What does ls -lF /proc/self/exe do when executed from the shell?

@saper
Copy link
Member

saper commented Jan 2, 2016

This is most probably caused by https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt

Non-standard behavior

(...)

Symlinks in /proc/PID/ and /proc/PID/fd which point to a non-directory
object in overlayfs will not contain valid absolute paths, only
relative paths leading up to the filesystem's root. This will be
fixed in the future.

(kudos to https://gist.github.com/shimarin/5c1833dcbb3ea4c04256#gistcomment-1546393)

@xzyfer
Copy link
Contributor

xzyfer commented Jan 2, 2016

Sounds like this should be fixed by #1322.

@saper
Copy link
Member

saper commented Jan 2, 2016

Don't think so, as this is the problem occurring in our installer, not the CLI. The fix will be simple once we fully understand the issue.

@bobbwal
Copy link
Author

bobbwal commented Jan 2, 2016

Hi, not really sure about the /proc file system, appears not?

$ ls -lF /proc/self/exe
ls: /proc/self/exe: No such file or directory

@saper
Copy link
Member

saper commented Jan 2, 2016 via email

@bobbwal
Copy link
Author

bobbwal commented Jan 2, 2016

Struggling a little on this but mount doesn't appear to be an available command.

saper added a commit to saper/node-sass that referenced this issue Jan 3, 2016
Remove red tape surrounding process.execPath
and use it as-is. In particular, do not try
to canonicalize the path returned by
process.execPath as this might be relative
in the restricted Linux environments
(for example using overlayfs).

We should be prepared to accept relative
or otherwise broken process.execPath and
have a faith it works (otherwise our
build scripts wouldn't be invoked
in the first place).

sass#1323
@saper
Copy link
Member

saper commented Jan 3, 2016

@bobbwal can you check if #1325 fixes this for you?

@bobbwal
Copy link
Author

bobbwal commented Jan 3, 2016

can you check if #1325 fixes this for you?

@saper it works!

@saper
Copy link
Member

saper commented Jan 3, 2016

Happy to hear that! Thank you for helping us to locate this issue .... and lots of luck working in your ehm environment :)

@bobbwal
Copy link
Author

bobbwal commented Jan 3, 2016

Thanks, and good work :)

@xzyfer
Copy link
Contributor

xzyfer commented Jan 20, 2016

This fix is on master and will be the next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants