Git Product home page Git Product logo

Comments (5)

c2tarun avatar c2tarun commented on June 14, 2024

Hello @jchirschy,

I am not able to reproduce your issue with following code:

package.json

{
  "name": "hello_world",
  "version": "1.0.0",
  "main": "app.js",
  "dependencies": {
    "axios": "^0.18.0"
  },
  "scripts": {
    "test": "mocha tests/unit/"
  },
  "optionalDependencies": {
    "jshint": "2.10.3"
  },
  "devDependencies": {
    "chai": "^4.2.0",
    "mocha": "^6.1.4"
  }
}

node_modules folder

$ /bin/ls .aws-sam/build/HelloWorldFunction/node_modules
axios			concat-map		fs.realpath		is-buffer		ms			wrappy
balanced-match		debug			inflight		lodash			once
brace-expansion		follow-redirects	inherits		minimatch		path-is-absolute

As you can see optionalDependency jshint is missing from node_modules folder.

I am using npm 6.9.0 with node 10.16.3. Can you please share more details about what you are seeing and what you expect?

Thanks
Tarun

from aws-lambda-builders.

jchirschy avatar jchirschy commented on June 14, 2024

Hello @c2tarun,

Thanks for your help.
Have you tried with optionalDependencies only ?
I typically use Lambda layers 'linked' to AWS lambda functions where there is no node_modules folder necessary for the Lambda functions.

from aws-lambda-builders.

jchirschy avatar jchirschy commented on June 14, 2024

Hello,

I confirm that optional dependencies are still added with the following configuration :

  • Node v12.18.2
  • SAM CLI, version 1.2.0

It works fine with :

  • Node v8.9.4
  • SAM CLI, version 1.2.0

Any idea ?

from aws-lambda-builders.

projected1 avatar projected1 commented on June 14, 2024

Please pay attention to your NPM versions.
While optional=false is expected to work with NPM 6, it was removed in NPM 7 where you should use omit=optional instead.
See https://docs.npmjs.com/cli/v7/using-npm/config#omit

from aws-lambda-builders.

aahung avatar aahung commented on June 14, 2024

Thank you @projected1 for sharing the info.
@jchirschy please open a new issue if you still encounter the issue. Closing due to unable to reproduce it and it is too outdated.

from aws-lambda-builders.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.