Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = function resolveSync(x, options) {
if (n) return maybeRealpathSync(realpathSync, n, opts);
}

var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'. Please verify that module installed, the package.json has 'main' field or module has index.js file");
err.code = 'MODULE_NOT_FOUND';
throw err;

Expand Down
4 changes: 2 additions & 2 deletions test/resolver_sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('foo', function (t) {
},
{
name: 'Error',
message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'"
message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'. Please verify that module installed, the package.json has 'main' field or module has index.js file"
}
);

Expand Down Expand Up @@ -275,7 +275,7 @@ test('sync: #121 - treating an existing file as a dir when no basedir', function
st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
st.equal(
e.message,
'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',
'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'. Please verify that module installed, the package.json has \'main\' field or module has index.js file',
'can not find nonexistent module'
);
}
Expand Down