Error: Cannot find module 'asn1.js'
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
- Domain
- build-system, tooling
Research direction
Run the reproduction in the ghaction-import-gpg repository through yarn run build, remove node_modules, and execute node dist/index.js. Inspect how ncc handles the openpgpjs dependencies listed in package.json and verify that the generated dist/index.js runs without manually installed modules.
Written by the indexing model from the issue text.
Description
Getting this error with asn1.js:
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'asn1.js'
Require stack:
- /home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at o (/home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js:1892:200)
at /home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js:1892:391
at Object.<anonymous> (/home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js:32512:27)
at Object.108.../../config (/home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js:33029:4)
at o (/home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js:1892:340)
at /home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js:1892:391 {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/work/_actions/crazy-max/ghaction-import-gpg/v1/dist/index.js'
]
}
This module is required by openpgpjs and used in the GitHub Action ghaction-import-gpg.
Current workaround, add the following deps in node_modules:
- asn1.js
- bn.js
- inherits
- minimalistic-assert
- safer-buffer
Looks like they are left out of the bundle by ncc.
Reproduce with:
git clone https://github.com/crazy-max/ghaction-import-gpg.git
cd ghaction-import-gpg/
yarn install
yarn run build
rm -rf node_modules/
node dist/index.js
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/ncc
-
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
-
Typescript 7 support Openhelp wanted
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
bug help wanted
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
ncc build generating multiple index.js files instead of a single bundle after upgrading Node.js Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100