amphtml: Transient "cannot find module" when running gulp test

bradfrizzell and I have been experiencing frequent errors like the following when running “gulp test”, both locally on our machines as well as on Travis. Restarting the test, or rebuilding and then re-running the test, generally fix the issue. The module that can’t be found seems to vary.

  {
    "message": "Uncaught Error: Cannot find module '/home/travis/build/ampproject/amphtml/test/integration/test-3p-frame.js'\nat /tmp/node_modules/browser-pack/_prelude.js:1:0 <- /tmp/d65e3526f9c22abf2a123e2513182be5.browserify:1:196\n\nError: Cannot find module '/home/travis/build/ampproject/amphtml/test/integration/test-3p-frame.js'\n    at s (/tmp/node_modules/browser-pack/_prelude.js:1:0 <- /tmp/d65e3526f9c22abf2a123e2513182be5.browserify:1:156)\n    at s (/tmp/node_modules/browser-pack/_prelude.js:1:0 <- /tmp/d65e3526f9c22abf2a123e2513182be5.browserify:1:122)\n    at test/integration/test-3p-frame.js:1:34",
    "str": "Uncaught Error: Cannot find module '/home/travis/build/ampproject/amphtml/test/integration/test-3p-frame.js'\nat /tmp/node_modules/browser-pack/_prelude.js:1:0 <- /tmp/d65e3526f9c22abf2a123e2513182be5.browserify:1:196\n\nError: Cannot find module '/home/travis/build/ampproject/amphtml/test/integration/test-3p-frame.js'\n    at s (/tmp/node_modules/browser-pack/_prelude.js:1:0 <- /tmp/d65e3526f9c22abf2a123e2513182be5.browserify:1:156)\n    at s (/tmp/node_modules/browser-pack/_prelude.js:1:0 <- /tmp/d65e3526f9c22abf2a123e2513182be5.browserify:1:122)\n    at test/integration/test-3p-frame.js:1:34"
  }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (17 by maintainers)

Most upvoted comments

It’s quite likely that this is due to https://github.com/nikku/karma-browserify/issues/114. The disk speed on Travis is slow, so we should wait longer than a second for all files to be loaded by the Karma server before the browserify transform is applied. See https://github.com/nikku/karma-browserify/issues/114#issuecomment-78289776 for a solution.

What the bundleDelay does: karma-browserify needs to wait for all files to be loaded by karma before it can actually start bundling. The bundleDelay is the timeout we accept until we assume karma handed over all files to us. If you have a slow disk (that needs more than the default delay to serve subsequent files the plug-in starts bundling without some files (the ones it later prints Cannot find module for).

PR coming up.

/cc @choumx @jridgewell @cvializ

This is still happening. I have a hunch this is due to https://github.com/gulpjs/gulp/issues/1412#issuecomment-159750720

Reopening to try a fix.

/cc @choumx