Comments (8)
same issue with npm
from serverless-webpack.
any update about this?
from serverless-webpack.
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/[email protected]_@[email protected][email protected][email protected][email protected]/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
from serverless-webpack.
@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.
from serverless-webpack.
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 likeconst 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.
from serverless-webpack.
@bebbi Responding to your questions,
- We are maintaining a long list of backward compatible features, think of it as a strength of this repo. Please use the original result of
isBerry = await isBerryVersion()
and only adds your changes in a new codepath (if), such that it covers both yarn v1 and v2+. - This should be an oversight between #1252 and #1258, I guess the correct way should be using the closest directory containing a
package.json
, counting upwards from cwd. - I think you almost hit it. If you are doing this in the temporary installation directory, and only does this when you detect a workspaces setting. Leaving all other cases (npm, yarn non-workspace... etc.) as-is.
- We should already have eslint-prettier in place. Reformatting the whole project is alwasy kind of a meh for multiple reasons. It is usually done in a project level refactor (e.g. rewrite in TypeScript), I tried this approach in 2020 as an attempt to remove bluebird, but keeping all the tests green is a bit much for me.
- Speaking with my experience in PNPM, lock file only references workspace versions. If you ensure an up to date lock file before bundling, our separated install should work. You may double confirm this in yarn.
- There is no guarantee when combined with other build-time plugins, but PR is always welcomed if you are able to isolate issue about
serverless-webpack
.
Let's create a PR and start from there, I'll walk you through.
from serverless-webpack.
Any suggestions available for the above?
I am currently using node 18, nx 17 and serverless latest.
from serverless-webpack.
Feel free to provide a PR based on what @vicary explained. Otherwise it doesn't help to ask for an update or a workaround :)
from serverless-webpack.
Related Issues (20)
- Webpack generating wrong symlink to package.json and node_modules on build HOT 1
- Duplicate "Setting artifact for function" logs (possible redundant calls to `setArtifactPath`?) HOT 2
- Typescript webpack still doesn't work, please help HOT 4
- Webpack doesn't respect --package flag when using deploy command HOT 1
- Allow glob or regex strings for forceExclude option HOT 2
- --webpack-use-polling Does not work with serverless offline start
- broken forceExclude for peerDep on node16(npm v. 8)
- if a function has an artifact set, webpack still create it's own
- sls invoke local won't work
- Individual packaging, dynamic config per compile step
- Run postInstall package script
- Allow generating ES Module (ESM) output from npm HOT 2
- ECR: do not assume a node runtime for image-based builds
- Runtime.ImportModuleError: Error: Cannot find module '@babel/runtime-corejs3/core-js-stable/json/stringify' HOT 5
- Error: yarn install --frozen-lockfile --non-interactive failed with code 1 HOT 4
- Help needed, excluding aws-sdk from Minimize build HOT 1
- .d.ts not recognize in serverless-webpack typescript HOT 2
- How to use `serverless webpack` to package "batches" of lambdas
- Error running serverless-webpack on Windows with latest Node LTS due to security update HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-webpack.