Branch: next
When installing @syncify/cli globally via pnpm add @syncify/cli@unstable -g, if you've previously installed the package and removed it, the postinstall script is not executed. This causes an error loop when running sy init and sy doctor.
Steps to Reproduce
- Install the package globally
pnpm add @syncify/cli@unstable -g
- Not sure if you'll need to use the package, in my case I ran through the
sy init procedure
- Remove the package globally
pnpm remove @syncify/cli -g
- Reinstall the package globally
pnpm add @syncify/cli@unstable -g
- Run
sy init
test-init-140425-1 sy init
┌─ Syncify ~ 12:35:25
│
│ v1.0.0-unstable.0
│
│ ERROR
│
│ Syncify is missing core reference files. Please report this issue on the github
│ repo, https://github.com/panoply/syncify/issues). This error may be due to a
│ corrupted installation which prevented postinstall hooks from firing.
│ How to fix?
│ Programmatic generation of core references may resolve this issue. Use the sy
│ doctor command and syncify will try and fix the problem. If the error persists,
│ please ensure read/write access permissions allow for directory and file
│ generation within /Users/wolfgreydev/.syncify location.
│
└─ Syncify ~ 12:35:26
- Following the instructions, running
sy doctor
test-init-140425-1 sy doctor
┌─ Syncify ~ 12:35:33
│
│ v1.0.0-unstable.0
│
│ UNKNOWN PROJECT
│
│ Syncify cannot run from this location as it is unknown. The necessary files and
│ references that would auto-confirm this directory as a valid project could not
│ be located.
│
│ /Users/wolfgreydev/Sites/shopify/playground/syncify-unstable/test-init-140425-1
│
│ ✕ no credentials
│ ✕ no targets
│ ✕ no config file
│
│ How to fix?
│ Run the sy init command if you would like to make this directory a Syncify
│ project. You can alternatively provide the necessary files/references. For more
│ information visit the setup guide: https://syncify.sh/setup/
│
└─ Syncify ~ 12:35:34
Expected Behavior
The postinstall script should run automatically during global installation.
Solution
As of pnpm v10.0.0, lifecycle scripts aren't automatically run and need to be approved. See here for more about this
After global installation, run pnpm approve-builds -g
➜ test-init-140425-1 pnpm approve-builds -g
✔ Choose which packages to build (Press <space> to select, <a> to toggle all, <i> to invert selection) · @parcel/watcher, @syncify/cli, esbuild
✔ The next packages will now be built: @parcel/watcher, @syncify/cli, esbuild.
Do you approve? (y/N) · true
.pnpm/esbuild@0.25.2/node_modules/esbuild: Running postinstall script, done in 458ms
.pnpm/@parcel+watcher@2.5.1/node_modules/@parcel/watcher: Running install script, done in 302ms
.pnpm/@syncify+cli@1.0.0-unstable.2/node_modules/@syncify/cli: Running postinstall script, done in 287ms
(Select at minimum @syncify/cli from the options)
Suggested Improvements
- Documentation: Add clear instructions about
pnpm approve-builds -g for global installs.
sy doctor Enhancement: Check if postinstall ran and suggest running approve-builds if missing.
Additional Context
The warning shown after global installation:
+ @syncify/cli 1.0.0-unstable.2
╭ Warning ──────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Ignored build scripts: @parcel/watcher, @syncify/cli, esbuild. │
│ Run "pnpm approve-builds -g" to pick which dependencies should be allowed to run scripts. │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────╯
Branch: next
When installing
@syncify/cliglobally viapnpm add @syncify/cli@unstable -g, if you've previously installed the package and removed it, thepostinstallscript is not executed. This causes an error loop when runningsy initandsy doctor.Steps to Reproduce
pnpm add @syncify/cli@unstable -gsy initprocedurepnpm remove @syncify/cli -gpnpm add @syncify/cli@unstable -gsy initsy doctorExpected Behavior
The
postinstallscript should run automatically during global installation.Solution
As of pnpm v10.0.0, lifecycle scripts aren't automatically run and need to be approved. See here for more about this
After global installation, run
pnpm approve-builds -g(Select at minimum
@syncify/clifrom the options)Suggested Improvements
pnpm approve-builds -gfor global installs.sy doctorEnhancement: Check ifpostinstallran and suggest runningapprove-buildsif missing.Additional Context
The warning shown after global installation:
+ @syncify/cli 1.0.0-unstable.2 ╭ Warning ──────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ Ignored build scripts: @parcel/watcher, @syncify/cli, esbuild. │ │ Run "pnpm approve-builds -g" to pick which dependencies should be allowed to run scripts. │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯