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

'run' command fails due to absent 'es6-promise' #1629

Closed
Treora opened this issue Jun 6, 2019 · 1 comment · Fixed by #1634
Closed

'run' command fails due to absent 'es6-promise' #1629

Treora opened this issue Jun 6, 2019 · 1 comment · Fixed by #1634
Projects

Comments

@Treora
Copy link

Treora commented Jun 6, 2019

Is this a feature request or a bug?

bug

What is the current behavior?

web-ext … run directly fails with an error: Error: Cannot find module 'es6-promise'.

The error appears related to one of web-ext’s dependencies, @cliqz-oss/node-firefox-connect. That dependency does however neatly install es6-promise as its dependency, so I have no idea why it is not found there. Perhaps the problem is somehow in the module resolver (or is it node or webpack doing the resolving here?).

The problem could perhaps disappear by cleaning up some of the forked dependencies; supposedly es6-promise is not even necessary anymore for the node-firefox-connect module. But it would be nice to figure out the source of the problem.

It is common to not encounter this error because npm often 'lifts' the es6-promise module for deduplication, with the side-effect that it will no longer fail to find it. Hence to reliably reproduce this error, install web-ext without dependency deduplication using --legacy-bundling. For example:

git clone https://github.com/mdn/webextensions-examples
cd webextensions-examples
npm install --legacy-bundling web-ext
npx web-ext -v -s beastify run

Relevant console output:

[program.js][error]
Error: Cannot find module 'es6-promise'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/user/webextensions-examples/node_modules/web-ext/dist/webpack:/external "es6-promise":1:1)
    at n (/home/user/webextensions-examples/node_modules/web-ext/dist/webpack:/webpack/bootstrap:19:1)
    at Object.<anonymous> (/home/user/webextensions-examples/node_modules/web-ext/dist/webpack:/node_modules/@cliqz-oss/node-firefox-connect/index.js:5:15)
    at n (/home/user/webextensions-examples/node_modules/web-ext/dist/webpack:/webpack/bootstrap:19:1)
    at Object.<anonymous> (/home/user/webextensions-examples/node_modules/web-ext/dist/webpack:/src/util/stdin.js:5:1)
    at Object.<anonymous> (/home/user/webextensions-examples/node_modules/web-ext/dist/webpack:/src/firefox/remote.js:250:10)

[program.js][error] Error code: MODULE_NOT_FOUND

Version information (for bug reports)

Firefox: 67
OS: Ubuntu
node: v8.16.0
npm: 6.9.0
web-ext: 3.0.0 (and earlier versions, since 2.5.0, which introduces the @cliqz-oss/node-firefox-connect dependency)

@cr-nz
Copy link

cr-nz commented Jun 20, 2019

Also encountering this issue. Reverting to 2.4.0 release fixes it.

@rpl rpl closed this as completed in #1634 Jun 25, 2019
@rpl rpl added this to To do in 3.1.0 via automation Jul 1, 2019
@rpl rpl moved this from To do to Done in 3.1.0 Jul 1, 2019
rpl added a commit to rpl/sign-addon that referenced this issue Nov 28, 2019
By using `import fs from "mz/fs"` instead of `import {fs} from "mz"`,
the resulting webpack bundle contains require calls for modules that
are not direct dependencies of the sign-addon package, but dependencies
of the mz package.

This small difference may trigger issues like:
mozilla/web-ext#1629

Which is now covered against regressions by a "smoke test" running
on the web-ext CI jobs (the smoke test triggers this kind of unexpected
issue by running all the functional tests on an environment created
using `npm install --production --legacy-bundling`, which generates
a non deduplicated node_modules directory tree).

Before this change:

npx js-beautify dist/sign-addon.js | grep require\(\"
npx: installed 29 in 1.819s
require("source-map-support").install(), module.exports = function(e) {
    e.exports = require("common-tags")
    e.exports = require("fs")
    e.exports = require("path")
    e.exports = require("url")
    e.exports = require("deepcopy")
    e.exports = require("jsonwebtoken")
    e.exports = require("request")
    e.exports = require("any-promise")
    e.exports = require("graceful-fs")
    e.exports = require("thenify-all")

and then after it:

require("source-map-support").install(), module.exports = function(e) {
    e.exports = require("common-tags")
    e.exports = require("fs")
    e.exports = require("path")
    e.exports = require("mz")
    e.exports = require("url")
    e.exports = require("deepcopy")
    e.exports = require("jsonwebtoken")
    e.exports = require("request")
willdurand pushed a commit to mozilla/sign-addon that referenced this issue Nov 29, 2019
By using `import fs from "mz/fs"` instead of `import {fs} from "mz"`,
the resulting webpack bundle contains require calls for modules that
are not direct dependencies of the sign-addon package, but dependencies
of the mz package.

This small difference may trigger issues like:
mozilla/web-ext#1629

Which is now covered against regressions by a "smoke test" running
on the web-ext CI jobs (the smoke test triggers this kind of unexpected
issue by running all the functional tests on an environment created
using `npm install --production --legacy-bundling`, which generates
a non deduplicated node_modules directory tree).

Before this change:

npx js-beautify dist/sign-addon.js | grep require\(\"
npx: installed 29 in 1.819s
require("source-map-support").install(), module.exports = function(e) {
    e.exports = require("common-tags")
    e.exports = require("fs")
    e.exports = require("path")
    e.exports = require("url")
    e.exports = require("deepcopy")
    e.exports = require("jsonwebtoken")
    e.exports = require("request")
    e.exports = require("any-promise")
    e.exports = require("graceful-fs")
    e.exports = require("thenify-all")

and then after it:

require("source-map-support").install(), module.exports = function(e) {
    e.exports = require("common-tags")
    e.exports = require("fs")
    e.exports = require("path")
    e.exports = require("mz")
    e.exports = require("url")
    e.exports = require("deepcopy")
    e.exports = require("jsonwebtoken")
    e.exports = require("request")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
3.1.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants