github-action icon indicating copy to clipboard operation
github-action copied to clipboard

No such file or directory 'package.json'

Open willgorick opened this issue 2 years ago • 3 comments

I have the following steps in my github action .yml file:

      - uses: actions/checkout@v2
      - name: Enter serverless dir and deploy
         uses: serverless/[email protected]
         with:
           args: -c "cd ./src/serverless && serverless plugin install --name serverless-plugin-tracing && serverless deploy"
           entrypoint: /bin/sh

But I'm getting an error, despite the fact that I do have a package.json file in my src/serverless folder: npm ERR! enoent ENOENT: no such file or directory, open '/github/home/.npm/_cacache/tmp/jrJNSF/package.json'

Does anyone know of a workaround/solution for this?

willgorick avatar Jun 03 '22 20:06 willgorick

The indent is wrong in you example, the entrypoint should be in the same level as args:

      - uses: actions/checkout@v2
      - name: Enter serverless dir and deploy
         uses: serverless/[email protected]
         with:
           args: -c "cd ./src/serverless && serverless plugin install --name serverless-plugin-tracing && serverless deploy"
           entrypoint: /bin/sh

pmckl avatar Jul 05 '22 18:07 pmckl

Sorry that was just a copy pasting mistake, the indentation of the entrypoint line is the same as args in my actual repo. I've updated my original comment to reflect this

willgorick avatar Jul 05 '22 23:07 willgorick

Created #90 to allow changing working directory and installing packages, should provide a cleaner way to accomplish this.

ryanlawson avatar May 18 '24 21:05 ryanlawson