Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'asn1.js' #538

Open
crazy-max opened this issue May 5, 2020 · 6 comments
Open

Error: Cannot find module 'asn1.js' #538

crazy-max opened this issue May 5, 2020 · 6 comments

Comments

@crazy-max
Copy link

crazy-max commented May 5, 2020

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
@vordimous
Copy link

I am seeing this issue using also with my implementation of openpgpjs.

@vordimous
Copy link

I found a workaround by forking the repo and updating their grunt script to include asn1.js

"openpgp": "https://github.com/vordimous/openpgpjs.git",

@satoruk
Copy link

satoruk commented Sep 25, 2020

@vordimous
I think it's a smart idea ✨
Would you be planning to send a PR to https://github.com/openpgpjs/openpgpjs ?

@vordimous
Copy link

opened a PR

I guess we will see if they want to change the way the lib is packaged.

@satoruk
Copy link

satoruk commented Sep 26, 2020

I hope it's accepted or resolved in some other way.

@vordimous
Copy link

There are some new workaround options from the openpgp dev on my PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants