Open bebbi opened 1 year ago
same issue with npm
@bebbi PR is welcomed, you may take reference of #1252 and use the function isBerryVersion
to give the correct args for yarn 2+ in getProdDependencies
.
@EhtashamAli npm ls
is backward compatible for many major versions, please further elaborate the situation in a new issue.
Hi @vicary I've made a quick fix for myself which I'm happy to share but it kills yarn classic support.
In order to turn this change into a proper PR, I will need contributor support:
I hard-coded isBerry = true (which is the reason for some tests now failing). Is there a reason for sticking to long promise chains or could this repo move to async/await? Things are a bit hard to read.
I reverted this line introduced by PR #1258. I am not sure it is helpful for classic? For berry at least, it cleanly separates workspaces and with that addition, it seems you end up just listing the packages at the workspace root which are unrelated.
I contaminated packExternalModules
with adding empty yarn lockfiles like const emptyLockFile = path.join(compositeModulePath, 'yarn.lock');
. In a monorepo, yarn will refuse to install in a non-workspace path unless there is at least an empty lockfile.
I did a lot of manual work to make a clean code diff possible after I noticed I had prettier on which formatted a lot of code. I think this repo is in need of a prettier run in order to be able to evolve. Removing eslint rules about formatting would be helpful, and instead prettier auto-formatting with lint-staged/husky.
I had to add a noFrozenLockfile
. From the way this works, I'm not sure you can achieve an immutable install in a monorepo esp. with stuff like transitive dependencies from monorepo deps. I haven't digged deep there.
I don't remember 100% whether this should work without serverless-plugin-monorepo
, haven't tested without.
@bebbi Responding to your questions,
isBerry = await isBerryVersion()
and only adds your changes in a new codepath (if), such that it covers both yarn v1 and v2+.package.json
, counting upwards from cwd.serverless-webpack
.Let's create a PR and start from there, I'll walk you through.
any update about this?
Any suggestions available for the above? I am currently using node 18, nx 17 and serverless latest.
Feel free to provide a PR based on what @vicary explained. Otherwise it doesn't help to ask for an update or a workaround :)
in my case
Environment: linux, node 18.20.2, framework 3.33.0 (local), plugin 6.2.3, SDK 4.3.2
Credentials: Local, "default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Error: npm install failed with code 1
at ChildProcess.<anonymous> (/home/user/Projects/aproject/node_modules/.pnpm/serverless-webpack@5.13.0_@types+node@20.11.17_serverless@3.33.0_typescript@3.9.10_webpack@4.46.0/node_modules/serverless-webpack/lib/utils.js:92:16)
at ChildProcess.emit (node:events:517:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:303:5)
2 deprecations found: run 'serverless doctor' for more details
error Command failed with exit code 1.
serverless-webpack/lib/utils.js does not log stdout and stderr, which make debugging difficult.
I manually edit the new SpawnError
code in the utils.js to log the stdout
This is a (Bug Report / Feature Proposal)
Bug
Description
For bug reports:
When trying to
yarn serverless package --stage=...
, the error isyarn list --depth=1 --json --production failed with code 1
Do not call
yarn list
or--production
as these are not supported byyarn berry
. For example hereFor feature proposals:
Similar or dependent issue(s):
642
Additional Data
but: yarn 3.4.1