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

Support alternative npm registries #1817

Open
EE2dev opened this issue Nov 13, 2024 · 3 comments
Open

Support alternative npm registries #1817

EE2dev opened this issue Nov 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@EE2dev
Copy link

EE2dev commented Nov 13, 2024

I am unable to setup observable framework at my workplace:

  • windows 10
  • node v20.18.0

To reroute npm installs to our internal registry, registry and other setting are placed in a .npmrc file in the home directory

  1. npx "@observablehq/framework@latest" create
  2. cd hello-framework
  3. npm run dev
    --> leads to an error:
GET /
npm:@observablehq/plot@latest → TypeError: fetch failed
    at node:internal/deps/undici/undici:13185:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async <myPath>/node_modules/@observablehq/framework/dist/npm.js:207:22{
  [cause]: Error: getaddrinfo ENOTFOUND [registry.npmjs.org](http://registry.npmjs.org/)

The only way I was able to fix it was to change line 200 in ./node_modules/@observablehq/framework/dist/npm.js
const href =https://registry.npmjs.org/${name}${disttag ? /${disttag} : ""};
with the URL of our registry.

Question 1: That doesn't seem to right way to set up observable, changing this file ?!

  1. As a result npm run dev (after modifying npm.js) leads to:
GET /
npm:@observablehq/plot@latest → TypeError: fetch failed
   at node:internal/deps/undici/undici:13185:13
   at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
   at async <mypath>/node_modules/@observablehq/framework/dist/npm.js:201:22 {
 [cause]: Error: self-signed certificate in certificate chain
     at TLSSocket.onConnectSecure (node:_tls_wrap:1677:34)
     at TLSSocket.emit (node:events:519:28)
     at TLSSocket._finishInit (node:_tls_wrap:1076:8)
     at ssl.onhandshakedone (node:_tls_wrap:862:12) {
   code: 'SELF_SIGNED_CERT_IN_CHAIN'
  }
}

Question 2: how can I fix this to proceed setting up framework?

I found

@EE2dev EE2dev added the bug Something isn’t working label Nov 13, 2024
@EE2dev EE2dev changed the title setip with npm run dev leads to Error: self-signed certificate in certificate chain setup with npm run dev leads to error: self-signed certificate in certificate chain Nov 13, 2024
@mbostock mbostock changed the title setup with npm run dev leads to error: self-signed certificate in certificate chain Support alternative npm registries Nov 13, 2024
@mbostock mbostock added enhancement New feature or request and removed bug Something isn’t working labels Nov 13, 2024
@mbostock
Copy link
Member

We don’t support alternative npm registries at the moment, but that’s a feature we could add. Currently Framework requires access to registry.npmjs.org and cdn.jsdelivr.net in order to install libraries from npm.

(This feels related to support for HTTP_PROXY, which you can implement in your config as described in #1168 (comment).)

@EE2dev
Copy link
Author

EE2dev commented Nov 13, 2024

Can I upvote the alternative npm registries option somewhere?

Do you think the second question is also solved when alternative registries are supported?

@mbostock
Copy link
Member

You can add a 👍 reaction to this issue that you filed, but that’s implied by you filing this issue in the first place. 😅 This isn’t the same as the HTTP_PROXY issue, and solving one doesn’t solve the other, but they are both related to supporting Framework on restricted networks and hence worth cross-linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants