Cannot resolve dependency 'async_hooks'
See original GitHub issue🐛 bug report
Parcel doesn’t seem to know that async_hooks
is a Node.js builtin when bundling with --target node
.
parcel build src/index.js --target node --bundle-node-modules
🤔 Expected Behavior
A require('async_hooks')
should be left as-is.
😯 Current Behavior
An error is thrown.
🚨 /app/node_modules/cls-hooked/context.js:7:28: Cannot resolve dependency 'async_hooks'
5 | const assert = require('assert');
6 | const wrapEmitter = require('emitter-listener');
> 7 | const async_hooks = require('async_hooks');
| ^
8 |
9 | const CONTEXTS_SYMBOL = 'cls@contexts';
10 | const ERROR_SYMBOL = 'error@context';
💁 Possible Solution
Add it to node-libs-browser
?
💻 Code Sample
require('async_hooks');
🌍 Your Environment
Software | Version(s) |
---|---|
Parcel | 1.12.3 |
Node | 12.1.0 alpine |
npm/Yarn | yarn@1.15.2 |
Operating System | Linux 1e250ea9327f 4.9.125-linuxkit |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Module not found: Can't resolve 'async_hooks' - Stack Overflow
The problem with 'async_hooks' is that it will only be available in node on serverside - if e.g. webpack tries to create a...
Read more >Module not found: Can't resolve 'async_hooks' error [Solved]
The command removes the single-build dependency from your project and copies the configuration files into your project as dependencies in package.json . shell....
Read more >Nodejs APM - Can't resolve 'async_hooks' - Elastic Discuss
Hello, We are trying to use APM for our React nodejs app. We have added the dependency in our package.json to install the...
Read more >open-telemetry/opentelemetry-node - Gitter
./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncHooksContextManager.js Module not found: Can't resolve 'async_hooks' in 'D:\.
Read more >@opentelemetry/context-async-hooks - npm
OpenTelemetry AsyncHooks-based Context Manager. Latest version: 1.8.0, last published: a month ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there any possible workaround for the 1.x branch - I’m stuck with parcel 1.x, because it is a dependency of @aws-cdk/aws-lambda-nodejs ?
This is only fixed in Parcel 2, not in Parcel 1.x.