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

Added Version number to package.json #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bitboxer
Copy link

Yarn fails if the package.json does not include a version number.

@Techn1x
Copy link

Techn1x commented Oct 30, 2024

I've also run into this, except with pnpm and the package.json is missing a name field.
Can't install file:../deps/phoenix_turnstile: Missing package name

Would you also mind adding a name as well?
name: 'phoenix_turnstile'

@Techn1x
Copy link

Techn1x commented Oct 30, 2024

If anyone else hits this, I've managed to work around it for the time being (without needing to point at a fork) by using pnpm install hooks, where we can set name (or other package.json properties) as needed.

// .pnpmfile.cjs

// This is a pnpm install hook to fix some broken packages that can't be fixed with pnpm patch
function readPackage(pkg, _context) {
  // The phoenix_turnstile package is missing some fields from its package.json that pnpm requires in order to install
  // See https://github.com/jsonmaur/phoenix-turnstile/pull/6
  if (pkg.main === 'priv/static/phoenix_turnstile.js' && pkg.name === undefined) {
    pkg.name = 'phoenix_turnstile'
  }

  return pkg
}

module.exports = {
  hooks: {
    readPackage,
  },
}

@Techn1x
Copy link

Techn1x commented Oct 30, 2024

cc @jsonmaur in case you have missed this

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 this pull request may close these issues.

2 participants