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

Print internal errors when precompiler setup or globbing fails #2202

Merged
merged 2 commits into from Aug 11, 2019

Conversation

yovasx2
Copy link
Contributor

@yovasx2 yovasx2 commented Aug 6, 2019

Fixes #2163
Now the error is:

➜  test npx ava test.js --verbose

  ✖ Couldn't find any files to test

  ✖ Internal error
  Error: ENOENT: no such file or directory, mkdir '/Users/yovasx2/test/node_modules/.cache/ava'
  Error: ENOENT: no such file or directory, mkdir '/Users/yovasx2/test/node_modules/.cache/ava'
      at Object.mkdirSync (fs.js:752:3)
      at AsyncFunction.module.exports.sync (/Users/yovasx2/test/node_modules/make-dir/index.js:108:6)
      at Api._setupPrecompiler (/Users/yovasx2/test/node_modules/ava/lib/api.js:278:11)
      at Api.run (/Users/yovasx2/test/node_modules/ava/lib/api.js:111:35)
      at Object.exports.run (/Users/yovasx2/test/node_modules/ava/lib/cli.js:283:31)
      at Object.<anonymous> (/Users/yovasx2/test/node_modules/ava/cli.js:10:23)
      at Module._compile (internal/modules/cjs/loader.js:701:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
      at Module.load (internal/modules/cjs/loader.js:600:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
      at Function.Module._load (internal/modules/cjs/loader.js:531:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
      at findNodeScript.then.existing (/usr/local/lib/node_modules/npm/node_modules/libnpx/index.js:268:14)

We cannot get EACCESS error since the library make-dir is using fs.mkdirSync with recursive option:

  • Without recursive, we obtain EACCESS
> fs.mkdirSync('/Users/yovasx2/test/node_modules/l')
{ Error: EACCES: permission denied, mkdir '/Users/yovasx2/test/node_modules/l'
    at Object.mkdirSync (fs.js:752:3)
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '/Users/yovasx2/test/node_modules/l' }
  • With recursive, we obtain ENOENT
> fs.mkdirSync('/Users/yovasx2/test/node_modules/l/l', {recursive: true})
{ Error: ENOENT: no such file or directory, mkdir '/Users/yovasx2/test/node_modules/l/l'
    at Object.mkdirSync (fs.js:752:3)
  errno: -2,
  syscall: 'mkdir',
  code: 'ENOENT',
  path: '/Users/yovasx2/test/node_modules/l/l' }

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

Catch exception created during `_setupPrecompiler` when you don't have permissions to write in the **node_modules** folder
try {
const precompiler = await this._setupPrecompiler();
let helpers = [];
precompiler = await this._setupPrecompiler(); // eslint-disable-line require-atomic-updates
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@novemberborn novemberborn changed the title Update api.js Print internal errors when precompiler setup or globbing fails Aug 11, 2019
@novemberborn
Copy link
Member

Nice, thanks @yovasx2!

For next time, please give the PR a more descriptive title. "Update api.js" doesn't communicate what you changed.

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 this pull request may close these issues.

TypeError: Cannot read property 'emitStateChange' of undefined
2 participants