GithubHelp home page GithubHelp logo

Comments (14)

aleguern avatar aleguern commented on June 14, 2024 2

I found the bug I'm sorry, it seems I forgot to install esbuild dependency at the lambda level, it was only installed at the root lebel.

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

Per the error message:

esbuild must be installed on the host machine to use this feature.

Do you have eslint installed on the machine running the workflow?

from setup-sam.

aleguern avatar aleguern commented on June 14, 2024

Yes I did install it with npm i -g esbuild, is there a different way to do this ?

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

So to be clear, esbuild is installed in the GitHub Actions environment (not only on development machine), and is in the PATH (i.e. you can use esbuild and it'll call the executable correctly)?

from setup-sam.

aleguern avatar aleguern commented on June 14, 2024

I run npm i -g esbuild and then run esbuild --version it displays the correct version 0.18.6

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

Can you include the relevant parts of your GitHub workflow? Specifically, where eslint and SAM CLI is installed, and where SAM CLI is called.

from setup-sam.

aleguern avatar aleguern commented on June 14, 2024
jobs:
  build-and-package:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm install
      - run: npm i -g esbuild
      - run: esbuild --version
      - uses: aws-actions/setup-sam@v2
        with:
          use-installer: true
      - name: Build resources
        run: sam build --template ${SAM_TEMPLATE} --use-container

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

With --use-container the project will be built in a container, so whatever is installed on the host won't be available in it. It should work if you make esbuild a project dependency, so that it's picked up in the container as well.

from setup-sam.

aleguern avatar aleguern commented on June 14, 2024

Thanks for your advice, I’m not sure what I’m supposed to do, could you tell me how to do this ?

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

Try adding it as a dependency to your package.json.

from setup-sam.

aleguern avatar aleguern commented on June 14, 2024

That’s already what I did and not working, I tried adding it to dependencies and devDependencies.

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

Interesting; can you share your package.json? And project structure as well if possible (to ensure it's picking up the correct package.json). We haven't been able to reproduce the issue.

from setup-sam.

mildaniel avatar mildaniel commented on June 14, 2024

Adding some extra context here. I was unable to reproduce this issue in GitHub actions. My setup looks like this and runs successfully

├── README.md
├── events
│   └── event.json
├── hello-world
│   ├── app.ts
│   ├── jest.config.ts
│   ├── package.json
│   ├── tests
│   │   └── unit
│   │       └── test-handler.test.ts
│   └── tsconfig.json
├── samconfig.toml
└── template.yaml

package.json

{
  "name": "hello_world",
  "version": "1.0.0",
  "description": "hello world sample for NodeJS",
  "main": "app.js",
 ...
  },
  "dependencies": {
    "esbuild": "^0.14.14"
  },
  "devDependencies": {
...
  }
}

and the workflow

name: Build

on: push

jobs:
  build:
    name: Build esbuild project
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      - uses: aws-actions/setup-sam@v2
        with:
          use-installer: true
      - run: sam build -u

I noticed you also specify the template. Can you confirm the template flag is pointing to the correct file?

from setup-sam.

hoffa avatar hoffa commented on June 14, 2024

No worries! Thanks for the update; good you found the issue.

from setup-sam.

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.