Closed gavry closed 1 year ago
Hey @gavry!
Thank you for reporting it. We have a fix on the way to make findInstalledVersion()
work with pnpm and it will be published soon. However, all errors in that detection (like the use of --package-lock-only
when you have no package-lock.json) are being caught, so they should not block CLI usage (although it does show a scary message). I just tested plasmic sync
in a repository with pnpm here and the script continues running after such errors:
$ plasmic sync
npm ERR! code ENOLOCK
npm ERR! ls This command requires an existing lockfile.
npm ERR! ls Try creating one first with: npm i --package-lock-only
npm ERR! ls Original error: loadVirtual requires existing shrinkwrap file
{
"error": {
"code": "ENOLOCK",
"summary": "This command requires an existing lockfile.",
"detail": "Try creating one first with: npm i --package-lock-only\nOriginal error: loadVirtual requires existing shrinkwrap file"
}
}
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tiago/.npm/_logs/2023-03-24T16_59_37_185Z-debug-0.log
Could not detect installed version of @plasmicapp/react-web using npm: Error: Command failed: npm list --package-lock-only --json @plasmicapp/react-web
npm ERR! code ENOLOCK
npm ERR! ls This command requires an existing lockfile.
npm ERR! ls Try creating one first with: npm i --package-lock-only
npm ERR! ls Original error: loadVirtual requires existing shrinkwrap file
{
"error": {
"code": "ENOLOCK",
"summary": "This command requires an existing lockfile.",
"detail": "Try creating one first with: npm i --package-lock-only\nOriginal error: loadVirtual requires existing shrinkwrap file"
}
}
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tiago/.npm/_logs/2023-03-24T16_59_37_185Z-debug-0.log
? A more recent version of @plasmicapp/react-web >=0.2.177 is required. Would you like to upgrade via "npm install --ignore-scripts @plasmicapp/react-web"? (Y/n)
Are there any other errors you see after that?
Also, thank you for the suggestion of adding a --skip-upgrade-check
flag. That will be added in the upcoming release of @plasmicapp/cli.
Thanks for the reply! I think, previously, the issue was:
So, it wasn't exactly an unexpected error, but it wasn't letting me proceed. But I'm not 100% sure, you guys would know the codebase much better 🤷
Anyways, I've upgraded to the latest CLI version and it totally works again! Thank you so much!!
As far as I can tell, a recent update is causing the following error message: "HandledError: "srcDir" in plasmic.json is outside of ."
It seems like the following function is the source: https://github.com/plasmicapp/plasmic/blob/c1f2560551d97e2e4b2c52669a262532795f54b2/packages/cli/src/utils/npm-utils.ts#L110-L146
Since yarn and npm are the only pms allowed, it defaults to npm in the else clause and runs "npm list --package-lock-only --json ${pkg}". This of course fails because there is no package-lock file.
One potential short-term fix would be to allow passing of --skip-upgrade-check as a CLI arg; this seems to be an escape hatch, but it's not possible to pass in as of now.
Thanks for this awesome software, btw! A lifesaver for small teams.