Skip to content

Uncaught error (sync nor async) if main field is not a string #178

Closed

Description

@unlight

How to repeat:

git clone https://gist.github.com/14c93c133d9657411e95959e22e32570.git main-is-not-a-string
cd main-is-not-a-string
npm i
node resolve-material-design-iconic-font.js
const resolve = require('resolve');

try {
	resolve('material-design-iconic-font', (err) => {
		console.log('async err', err);
	});	
} catch (err) {
	console.log('sync err', err);
} 

Actual:

path.js:39
    throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
    at assertPath (path.js:39:11)
    at Object.resolve (path.js:168:7)
    at \Dev\browserify-resolve-zavoloklom-material-design-iconic-font-issue-111\node_modules\resolve\lib\async.js:164:37
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

Expected:
Error should be caught in callback or in catch

resolve: 1.8.1
node v10.8.0

Related issues:
unlight/sublime-import-helper#61
zavoloklom/material-design-iconic-font#111

Activity

  1. unlight commented on Dec 13, 2018

    @unlight
    Author

    main for this package is:

      "main": [
        "./dist/css/*",
        "./dist/fonts/*"
      ],
    
  2. ljharb commented on Dec 13, 2018

    @ljharb
    Member

    @unlight either way, that package is broken; main can only be a string. I’d file a bug on that package.

  3. unlight commented on Dec 13, 2018

    @unlight
    Author

    The question is how can I detect that package is broken.

  4. ljharb commented on Dec 13, 2018

    @ljharb
    Member

    For sure, I definitely think this is a bug :-)

  5. ljharb commented on Dec 13, 2018

    @ljharb
    Member

    Thanks for the perfect repro - a fix will be merged shortly, and included in the next release.

  6. added 4 commits that reference this issue on Dec 17, 2018
    544ec7a
    c268cc0
    4b2b392
    254bb40
  7. added 2 commits that reference this issue on Jan 17, 2019
    09dc3e8
    d098e92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions