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

ESM: working on 10.15.2, fails on 10.15.3? #27846

Closed
patrikbeno opened this issue May 24, 2019 · 3 comments
Closed

ESM: working on 10.15.2, fails on 10.15.3? #27846

patrikbeno opened this issue May 24, 2019 · 3 comments
Labels
esm Issues and PRs related to the ECMAScript Modules implementation.

Comments

@patrikbeno
Copy link

  • Version: 10.15.3
  • Platform: Docker: node:10.15.3-alpine
  • Subsystem: ES modules

Working on 10.15.2:

FROM node:10.15.2-alpine as esm_working
WORKDIR /bugcheck
RUN npm init -y
RUN npm i request request-promise
RUN echo "import request from 'request-promise'" > bugcheck.mjs
RUN node --experimental-modules bugcheck.mjs

Failing on 10.15.3:

FROM node:10.15.3-alpine as esm_failing
WORKDIR /bugcheck
RUN npm init -y
RUN npm i request request-promise
RUN echo "import request from 'request-promise'" > bugcheck.mjs
RUN node --experimental-modules bugcheck.mjs

Error: request-promise is trying to load request library but fails:

TypeError: Cannot read property 'onReady' of undefined
    at Module.load (internal/modules/cjs/loader.js:611:22)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/bugcheck/node_modules/psl/index.js:14:19)
    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 Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/bugcheck/node_modules/tough-cookie/lib/pubsuffix-psl.js:32:11)
    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 Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/bugcheck/node_modules/tough-cookie/lib/cookie.js:35:17)

What has changed?
Was that intentional or is it a regression?

@patrikbeno
Copy link
Author

In "legacy" require() mode, all is OK:

FROM node:10.15.3-alpine as require_working
WORKDIR /bugcheck
RUN npm init -y
RUN npm i request request-promise
RUN echo "const request = require('request-promise')" > bugcheck.mjs
RUN node bugcheck.mjs

@guybedford
Copy link
Contributor

This was fixed in #25491 on Node.js 12.

We can backport that fix to the 10x branch too.

@lpinca lpinca added the esm Issues and PRs related to the ECMAScript Modules implementation. label May 25, 2019
@ZYSzys
Copy link
Member

ZYSzys commented Aug 28, 2019

This was backported into v10, try to upgrate your Node.js version to latest LTS(v10.16).

@ZYSzys ZYSzys closed this as completed Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

No branches or pull requests

4 participants