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

Error: Package manager is not detected #180

Closed
vipulgupta2048 opened this issue Oct 4, 2023 · 9 comments · Fixed by #190
Closed

Error: Package manager is not detected #180

vipulgupta2048 opened this issue Oct 4, 2023 · 9 comments · Fixed by #190
Assignees

Comments

@vipulgupta2048
Copy link

vipulgupta2048 commented Oct 4, 2023

With the latest wrangler-action version, we were getting the following error due to the latest changes.

file:///home/runner/work/_actions/cloudflare/wrangler-action/5a6b8d26847f6ab196fd2441fc52dc87b72c1b99/dist/index.mjs:2923
    throw new Error("Package manager is not detected");
          ^

Error: Package manager is not detected
    at realPackageManager (file:///home/runner/work/_actions/cloudflare/wrangler-action/5a6b8d26847f6ab196fd2441fc52dc87b72c1b99/dist/index.mjs:2923:11)
    at file:///home/runner/work/_actions/cloudflare/wrangler-action/5a6b8d26847f6ab196fd2441fc52dc87b72c1b99/dist/index.mjs:2925:48

Adding packageManager: npm to the actions YML file, in our case, resolved the issue after some digging around from the recent commits. Maybe create this as optional since this wasn't needed before? Or detecting it?

@ghost
Copy link

ghost commented Oct 8, 2023

What does your .yml file look like with the packageManager: npm (where does it go)? I'm not very familiar with Github Action syntax.

@vipulgupta2048
Copy link
Author

Here's an example:

- name: Deploy to Cloudflare Pages
        uses: cloudflare/[email protected] 
        with:
          apiToken: ${{ secrets.CF_API_TOKEN }}
          accountId: ${{ secrets.CF_ACCOUNT_ID }}
          wranglerVersion: '3.5.1' # latest - https://www.npmjs.com/package/wrangler
          preCommands: wrangler --version
          command: pages publish --branch $CF_BRANCH --project-name=$cloudflare_website  build/ | tee -a $GITHUB_STEP_SUMMARY
          packageManager: npm      # This is what you add

@HeilAsuka
Copy link

I addpackageManager: npmbeforecommand:xxxxxx,this error disappear. 😃 Thanks.

@vipulgupta2048
Copy link
Author

Yeah the location of the packageManager: npm or whatever package manager you use, shouldn't matter. Although folks looking at this issue if you can add your reaction to help the maintainers see this is not an isolated issue, then that be great. AFK for a couple of days, otherwise would submit a change myself.

@1000hz
Copy link
Contributor

1000hz commented Oct 9, 2023

Sorry about the trouble here. packageManager should indeed be optional. I think the best course of action is for us to fallback to npm instead of throwing an error if packageManager isn't specified and we can't infer the appropriate one to use based on lockfiles present in your repo. If you do specify packageManager, we should use that instead of trying to infer it. I'll work on a fix for this.

1000hz added a commit that referenced this issue Oct 9, 2023
Booligoosh added a commit to Booligoosh/sydneybikemap that referenced this issue Oct 10, 2023
@vipulgupta2048
Copy link
Author

Thanks for looking into this @1000hz Are you considering only the JS ecosystem package manager with this property. Clarification on what this does might be helpful, thanks!

@1000hz
Copy link
Contributor

1000hz commented Oct 10, 2023

@vipulgupta2048 yes, only JS package managers are supported. Specifically: npm, yarn, pnpm (with bun support being added soon)

@github-project-automation github-project-automation bot moved this from Backlog to Done in workers-sdk Oct 10, 2023
@1000hz
Copy link
Contributor

1000hz commented Oct 10, 2023

[email protected] has been released which fixes this issue. You can safely remove the packageManager: npm from your workflow if you added it as a result of this bug.

@vipulgupta2048
Copy link
Author

Thanks @1000hz appreciate the response. Cheers!

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

Successfully merging a pull request may close this issue.

3 participants