-
Notifications
You must be signed in to change notification settings - Fork 35
Cannot find module
error for Node-provided package
#743
Comments
Hi @benmccann, thank you for reporting this issue! I have an idea of what this may be caused by. Will look into it more tomorrow. |
I was able to fix this by upgrading |
I face the same issue. I put together a repository where behavior can be reproduced: https://github.com/marovargovcik/netlify-functions-demo Function is located in src/functions directory and is transpilled to ES5 with rollup by running I am trying to have Netlify function written in modern JavaScript (?? operator, ?. property accessing) and run by Netlify without complaining about syntax errors (? unexpected character) or having a problem with import statements etc. |
I'm not using |
Did some more digging. This error happens when you're using zip-it-and-ship-it's dependency resolution mechanism, which uses the Node's builtin You can unblock yourselves by using the |
Ah, this was entirely unclear to me. I had checked the docs and they make no mention of Node 16 being unsupported. I had put |
As a potential fix to this, what if we changed |
I also wonder why |
@benmccann some confusion here I think: As per the docs, the build environment supports any released version of Node, while the AWS Lambda runtime environment (specified by
Netlify functions don't actually need to be their own package, and the functions directory does not need to have a
ZISI then zips only those modules |
Perhaps there should be an option to continue if the package cannot be found? Or alternatively, or in addition, we could use the |
@Xenonym I couldn't have said it better! Some more context about why we need to keep function size down: AWS Lambda constrains total bundle size to 50mb. Because your The observed issue, where |
However, I'm still getting deployment failures: netlify/cli#3533 (comment) |
This is now working. Existing projects will need to "clear cache and deploy" Thanks for all the help!! |
@benmccann I'm still experiencing this issue on my existing project even after clearing the cache and re-deploying. @netlify-team-account-1 do you know what could go wrong? I had to change the |
- Do you want to request a feature or report a bug? bug
- What is the current behavior? build fails with error
Cannot find module 'stream/package.json'
- If the current behavior is a bug, please provide the steps to reproduce.
npm init svelte@next
.nvmrc
with the contents16
to use Node 16- What is the expected behavior?
There should be no need to install a
stream
package because it is provided by Node: https://nodejs.org/api/stream.html#stream_streamI'm not sure why it's trying to find
stream/package.json
and failing since this is a built-in package- Please mention your node.js, and operating system version.
Node 16. Linux
The text was updated successfully, but these errors were encountered: