Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXCLUDE_GLOBS causes failure for directory with a git submodule #272

Open
ekkards opened this issue May 10, 2017 · 2 comments
Open

EXCLUDE_GLOBS causes failure for directory with a git submodule #272

ekkards opened this issue May 10, 2017 · 2 comments
Labels

Comments

@ekkards
Copy link

ekkards commented May 10, 2017

If a git submodule is listed in package.json

  "dependencies": {
  ....
    "sub-module": "file:sub-module"
  },

and the directory name is within EXCLUDE_GLOBS
EXCLUDE_GLOBS="sub-module"
the following error occurs.

As a workaround, one can exclude the directory content EXCLUDE_GLOBS="sub-module/*", but this leaves sub-module/package.json in the zip file.

$ node-lambda package
Warning!!! You are building on a platform that is not 64-bit Linux (darwin.x64). If any of your Node dependencies include C-extensions, they may not work as expected in the Lambda environment.


=> Moving files to temporary directory
=> Running npm install --production
/usr/local/lib/node_modules/node-lambda/lib/main.js:543
      throw err;
      ^

Error: Command failed: npm -s install --production --prefix /var/folders/4c/b2p9cxl9699211w4mps998g40000gp/T/apiAccess-1494407987225

    at ChildProcess.exithandler (child_process.js:204:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)
$ 
@abetomo
Copy link
Contributor

abetomo commented May 10, 2017

@ekkards
Thanks for the report.
It was confirmed that package.json is not excluded, but it seems to be a problem that npm install fails as follows.

===>
node-lambda package does the following processing.

  1. Create a temporary directory and copy the project's files
  2. Run npm install --production in that temporary directory
  3. Zip the temporary directory

In this case, since EXCLUDE_GLOBS="sub-module" is specified, sub-module is not copied to temporary directory in phase 1, it seems that npm install of 2 has failed.

@ekkards
Copy link
Author

ekkards commented May 11, 2017

Thank you for the explanation with npm in the temporary directory. Now it is clearer:

  • since npm install is run, the subdirectory sub-module must be present in the temp directory for the npm to succeed.
  • the npm install copies the files from sub-module to node_modules/sub-module
  • node_modules is then zipped

If I exclude the files of the sub-module, the resulting zip is not working, as I found out now.
So lets keep the files of a git submodule.
Suggest to close the issue.

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

No branches or pull requests

3 participants