Skip to content

Cannot compile node-gyp modules on Lambda #6

@redbugz

Description

@redbugz

I was able to get around the deploy issues and get this deployed to Lambda using some of the code from the forks, but once it is deployed, I cannot get it to correctly compile a node-gyp module like contextify as an example.

Perhaps it is because I am using the new 4.3.2 Node.js runtime on Lambda and maybe they tightened down what it can do.
First, npm and node-gyp both want to put files in your $HOME directory, which is not writeable in current Lambda, resulting in EROFS errors. So setting $HOME=/tmp seemed to fix that problem.
Then it tried to actually compile something and now it can't find g++
make: g++: Command not found
and I haven't been able to find a way to get around that yet.

I have an older instance deployed on the 0.10.46 Node.js runtime, and I get this error there:

"/var/task/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:54",
        "    throw new Error(",
        "          ^",
        "Error: node-gyp requires that the user's home directory is specified in either of the environmental variables HOME or USERPROFILE",

which could probably be fixed by setting $HOME=/tmp, but that runtime is going away, so I don't really want to spend time getting it to work.

Has anyone gotten this approach to work, using Lambda to compile node_modules for Lambda?
Or is EC2 really the only approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions