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

compat: tracking issue for running npm #13187

Closed
7 tasks done
kt3k opened this issue Dec 23, 2021 · 12 comments
Closed
7 tasks done

compat: tracking issue for running npm #13187

kt3k opened this issue Dec 23, 2021 · 12 comments
Assignees

Comments

@kt3k
Copy link
Member

kt3k commented Dec 23, 2021

npm (show help message) ✅

npm init

npm install <dep>

  • TypeError: req.abort is not function minipass-fetch/lib/index.js:73 in minipass-fetch
  • npm ERR! request to https://***:undefined@registry.npmjs.org/pretty-bytesnullnullnullnullnullnull failed, reason: this.cb is not a function looks enigmatic. Something's wrong with https.request?
@bartlomieju
Copy link
Member

When trying to run npm init I get:

Not implemented: process.on("uncaughtException")
Not implemented: process.on("unhandledRejection")
npm ERR! Cannot assign to read only property 'name' of function 'class Init extends BaseCommand {
npm ERR!   static description = 'Create a package.json file'
npm ERR!   static params = ['yes', ...<omitted>...
npm ERR! }'

@ry ry mentioned this issue Dec 23, 2021
18 tasks
@kt3k
Copy link
Member Author

kt3k commented Dec 24, 2021

@bartlomieju I can't reproduce the above error on my machine. How do you execute npm?

@kt3k
Copy link
Member Author

kt3k commented Dec 24, 2021

BTW I use npm@7.21.1. What version do you use?

@bartlomieju
Copy link
Member

@bartlomieju I can't reproduce the above error on my machine. How do you execute npm?

I got it cloned locally, and I execute it like: deno run --unstable -A --compat --no-check index.js init (I set up DENO_NODE_COMPAT_URL prior to execution). The version is 8.1.4

@bartlomieju
Copy link
Member

npm ERR! request to https://***:undefined@registry.npmjs.org/pretty-bytesnullnullnullnullnullnull failed, reason: this.cb is not a function looks enigmatic. Something's wrong with https.request?

This seems like an issue with ClientRequest being a class in std/node, while in Node it's written in ES5 function class syntax. I'm not 100% sure, but it seems similar to other issues we had when using class based approach.

@bartlomieju bartlomieju self-assigned this Jan 4, 2022
@bartlomieju
Copy link
Member

npm ERR! request to https://***:undefined@registry.npmjs.org/pretty-bytesnullnullnullnullnullnull failed, reason: this.cb is not a function looks enigmatic. Something's wrong with https.request?

This seems like an issue with ClientRequest being a class in std/node, while in Node it's written in ES5 function class syntax. I'm not 100% sure, but it seems similar to other issues we had when using class based approach.

this.cb being null is actually valid in Node code, however we're handling it not properly. I have no idea why the URL for fetch is mangled so badly, I've been debugging this issue for the past 3 hours and haven't made any progress.

@bartlomieju
Copy link
Member

npm install should now work with latest deno_std. Thanks @AaronO for help.

@kt3k
Copy link
Member Author

kt3k commented Jan 13, 2022

Wow. Great! Thanks! @AaronO

@kt3k
Copy link
Member Author

kt3k commented Jan 18, 2022

Tried on my machine. I still see this kind of error (with npm@8.x & 7.x):

$ npm install pretty-bytes
Not implemented: process.on("uncaughtException")
Not implemented: process.on("unhandledRejection")
error: Uncaught (in promise) TypeError: w.write is not a functiondDeps
    nwritten += await w.write(arr.subarray(nwritten));
                        ^
    at writeAll (file:///Users/kt3k/denoland/deno_std/streams/conversion.ts:350:25)
    at innerWrite (file:///Users/kt3k/denoland/deno_std/node/_fs/_fs_write.js:20:12)
    at Object.write (file:///Users/kt3k/denoland/deno_std/node/_fs/_fs_write.js:23:3)

What version have you tested?

@kt3k
Copy link
Member Author

kt3k commented Jan 18, 2022

nevermind. I found the cause. Will send a PR to std soon

@kt3k
Copy link
Member Author

kt3k commented Jan 18, 2022

denoland/std#1832

@bartlomieju
Copy link
Member

Just checked again, and I still can't run latest version of npm (v8):

❯ deno run --compat --unstable -A ../cli/bin/npm-cli.js install
Not implemented: process.on("uncaughtException")
Not implemented: process.on("unhandledRejection")
npm ERR! Cannot assign to read only property 'name' of function 'class Install extends ArboristWorkspaceCmd {
npm ERR!   static description = 'Install a package'
npm ERR!   static name = 'instal...<omitted>...
npm ERR! }'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ib/.npm/_logs/2022-02-08T02_04_41_400Z-debug-0.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants