jdx / npm-register

Your own private npm registry and backup server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to find `npm view @...` packages

gwing33 opened this issue · comments

Some packages (e.g. @types/react and @storybook/react) aren't found when doing npm view. Seems like it needs to handle @ signs.

Current workaround is to add an .npmrc file with

@types:registry=https://registry.npmjs.org/
@storybook:registry=https://registry.npmjs.org/

But this isn't ideal as the purpose for us using this is to cache npm libs outside of the official npm registry.

commented

these work fine on our registry

$ npm view @types/react --registry https://cli-npm.heroku.com
{ name: '@types/react',
  description: 'TypeScript definitions for React',
  'dist-tags': 
   { latest: '16.0.5',
     'ts2.0': '15.0.1',
     'ts2.1': '15.0.20',
     'ts2.2': '15.0.30',
     'ts2.3': '16.0.5',
     'ts2.4': '16.0.5',
     'ts2.5': '16.0.5',
     'ts2.6': '16.0.4' },
  versions: 
   [ '0.0.0',
     '0.14.14-alpha',
     '0.14.15-alpha',
     '0.14.20-alpha',
     '0.14.21-alpha',
     '0.14.22-alpha',
     '0.14.23-alpha',
     '0.14.24-alpha',
     '0.14.25-alpha',
     '0.14.26-alpha',
     '0.14.27',
     '0.14.28',
     '0.14.29',
     '0.14.30',
     '0.14.31',
     '0.14.32',
     '0.14.33',
     '0.14.34',
     '0.14.35',
     '0.14.36',
     '0.14.37',
     '0.14.38',
     '0.14.39',
     '0.14.40',
     '0.14.41',
     '0.14.42',
     '0.14.43',
     '0.14.44',
     '0.14.45',
     '0.14.46',
     '0.14.47',
     '0.14.48',
     '0.14.49',
     '0.14.50',
     '0.14.51',
     '0.14.52',
     '0.14.53',
     '0.14.54',
     '0.14.55',
     '0.14.56',
     '0.14.57',
     '15.0.0',
     '15.0.1',
     '15.0.2',
     '15.0.3',
     '15.0.4',
     '15.0.5',
     '15.0.6',
     '15.0.7',
     '15.0.8',
     '15.0.9',
     '15.0.10',
     '15.0.11',
     '15.0.12',
     '15.0.13',
     '15.0.14',
     '15.0.15',
     '15.0.16',
     '15.0.17',
     '15.0.18',
     '15.0.19',
     '15.0.20',
     '15.0.21',
     '15.0.22',
     '15.0.23',
     '15.0.24',
     '15.0.25',
     '15.0.26',
     '15.0.27',
     '15.0.28',
     '15.0.29',
     '15.0.30',
     '15.0.31',
     '15.0.32',
     '15.0.33',
     '15.0.34',
     '15.0.35',
     '15.0.36',
     '15.0.37',
     '15.0.38',
     '15.0.39',
     '15.6.0',
     '15.6.1',
     '16.0.0',
     '16.0.1',
     '16.0.2',
     '16.0.3',
     '16.0.4',
     '16.0.5' ],
  maintainers: [ 'types <ts-npm-types@microsoft.com>' ],
  time: 
   { modified: '2017-08-23T17:54:45.908Z',
     created: '2016-05-17T18:43:22.882Z',
     '0.14.14-alpha': '2016-05-17T18:43:22.882Z',
     '0.14.15-alpha': '2016-05-19T22:08:27.879Z',
     '0.14.20-alpha': '2016-05-20T20:30:27.902Z',
     '0.14.21-alpha': '2016-05-25T05:46:19.103Z',
     '0.14.22-alpha': '2016-07-01T20:29:25.078Z',
     '0.14.23-alpha': '2016-07-01T23:51:20.607Z',
     '0.14.24-alpha': '2016-07-02T03:16:22.782Z',
     '0.14.25-alpha': '2016-07-04T01:12:46.943Z',
     '0.14.26-alpha': '2016-07-08T21:18:26.724Z',
     '0.14.27': '2016-07-14T15:49:49.149Z',
     '0.14.28': '2016-08-02T16:05:51.143Z',
     '0.14.29': '2016-08-08T20:37:33.802Z',
     '0.14.30': '2016-08-15T18:37:42.743Z',
     '0.14.31': '2016-08-19T15:38:24.089Z',
     '0.14.32': '2016-08-22T17:58:41.498Z',
     '0.14.33': '2016-08-25T18:54:39.713Z',
     '0.14.34': '2016-09-06T14:53:43.381Z',
     '0.14.35': '2016-09-19T18:07:09.708Z',
     '0.14.36': '2016-09-21T20:28:15.865Z',
     '0.14.37': '2016-09-23T18:00:01.549Z',
     '0.14.38': '2016-10-03T18:37:42.089Z',
     '0.14.39': '2016-10-05T21:01:16.111Z',
     '0.14.40': '2016-10-11T18:48:21.965Z',
     '0.14.41': '2016-10-11T21:58:40.866Z',
     '0.14.42': '2016-10-25T13:21:06.250Z',
     '0.14.43': '2016-10-26T19:27:52.746Z',
     '0.14.44': '2016-10-31T16:20:47.382Z',
     '0.14.45': '2016-11-08T13:39:35.767Z',
     '0.14.46': '2016-11-08T14:56:35.245Z',
     '0.14.47': '2016-11-10T12:27:58.162Z',
     '0.14.48': '2016-11-14T19:37:03.771Z',
     '0.14.49': '2016-11-17T06:28:35.266Z',
     '0.14.50': '2016-11-21T14:48:18.895Z',
     '0.14.51': '2016-11-28T16:30:56.657Z',
     '0.14.52': '2016-11-30T23:09:33.029Z',
     '0.14.53': '2016-12-05T22:54:42.199Z',
     '0.14.54': '2016-12-06T22:24:40.875Z',
     '0.14.55': '2016-12-11T17:32:58.229Z',
     '0.14.56': '2017-01-05T21:17:52.047Z',
     '0.14.57': '2017-01-06T15:26:37.855Z',
     '0.0.0': '2017-01-06T16:36:26.817Z',
     '15.0.0': '2017-01-11T02:24:28.792Z',
     '15.0.1': '2017-01-20T17:18:08.109Z',
     '15.0.2': '2017-01-23T21:33:22.003Z',
     '15.0.3': '2017-01-25T02:14:24.610Z',
     '15.0.4': '2017-01-25T18:38:22.177Z',
     '15.0.5': '2017-01-30T22:14:50.787Z',
     '15.0.6': '2017-02-01T08:11:33.078Z',
     '15.0.7': '2017-02-07T20:44:47.437Z',
     '15.0.8': '2017-02-08T21:36:23.429Z',
     '15.0.9': '2017-02-10T23:03:10.830Z',
     '15.0.10': '2017-02-15T17:41:06.386Z',
     '15.0.11': '2017-02-17T21:37:24.598Z',
     '15.0.12': '2017-02-23T00:51:23.293Z',
     '15.0.13': '2017-02-27T14:46:10.859Z',
     '15.0.14': '2017-03-01T23:18:02.452Z',
     '15.0.15': '2017-03-09T19:27:47.396Z',
     '15.0.16': '2017-03-11T00:22:54.012Z',
     '15.0.17': '2017-03-21T00:28:24.132Z',
     '15.0.18': '2017-03-21T21:13:25.456Z',
     '15.0.19': '2017-03-24T16:02:24.299Z',
     '15.0.20': '2017-03-24T16:30:39.696Z',
     '15.0.21': '2017-03-31T16:48:07.807Z',
     '15.0.22': '2017-04-17T17:57:16.237Z',
     '15.0.23': '2017-04-25T15:58:30.116Z',
     '15.0.24': '2017-05-04T23:19:54.169Z',
     '15.0.25': '2017-05-24T16:36:33.692Z',
     '15.0.26': '2017-06-02T13:31:01.832Z',
     '15.0.27': '2017-06-05T19:56:44.641Z',
     '15.0.28': '2017-06-12T22:17:04.667Z',
     '15.0.29': '2017-06-15T20:17:28.016Z',
     '15.0.30': '2017-06-20T20:48:30.645Z',
     '15.0.31': '2017-06-23T14:04:15.454Z',
     '15.0.32': '2017-06-26T21:08:55.421Z',
     '15.0.33': '2017-06-27T13:55:39.427Z',
     '15.0.34': '2017-06-30T21:46:29.411Z',
     '15.0.35': '2017-07-06T20:16:06.839Z',
     '15.0.36': '2017-07-10T19:47:18.886Z',
     '15.0.37': '2017-07-11T14:02:02.213Z',
     '15.0.38': '2017-07-12T21:18:20.536Z',
     '15.0.39': '2017-07-24T18:02:18.275Z',
     '15.6.0': '2017-07-27T21:51:36.370Z',
     '16.0.0': '2017-08-01T14:06:51.211Z',
     '15.6.1': '2017-08-01T14:06:59.155Z',
     '16.0.1': '2017-08-07T16:24:36.824Z',
     '16.0.2': '2017-08-09T14:13:23.182Z',
     '16.0.3': '2017-08-21T22:01:26.045Z',
     '16.0.4': '2017-08-22T15:53:43.000Z',
     '16.0.5': '2017-08-23T17:54:45.370Z' },
  license: 'MIT',
  readmeFilename: '',
  repository: 
   { type: 'git',
     url: 'https://www.github.com/DefinitelyTyped/DefinitelyTyped.git' },
  users: 
   { m0a: true,
     samar: true,
     nisimjoseph: true,
     sternelee: true,
     tomekf: true,
     alexxnica: true },
  contributors: 
   [ 'Asana (https://asana.com)',
     'AssureSign (http://www.assuresign.com)',
     'Microsoft (https://microsoft.com)',
     'John Reilly (https://github.com/johnnyreilly)',
     'Benoit Benezech (https://github.com/bbenezech)',
     'Patricio Zavolinsky (https://github.com/pzavolinsky)',
     'Digiguru (https://github.com/digiguru)',
     'Eric Anderson (https://github.com/ericanderson)',
     'Albert Kurniawan (https://github.com/morcerf)',
     'Tanguy Krotoff (https://github.com/tkrotoff)',
     'Dovydas Navickas (https://github.com/DovydasNavickas)',
     'Stéphane Goetz (https://github.com/onigoetz)',
     'Rich Seviora (https://github.com/richseviora)' ],
  etag: 'W/"599dc165-1b6d5"',
  version: '16.0.5',
  main: '',
  scripts: {},
  dependencies: {},
  typesPublisherContentHash: '49da356b04651ecc14781bed670b4f62fc73ef8f9f0c583affba9f13ca21c61f',
  typeScriptVersion: '2.3',
  dist: 
   { integrity: 'sha512-Wo/JT6Cpl7XuLA1Ov2M2Rso4Tep7rX6h1csbqhNDaSxqeY8nxUbrDkT6vJrKVu+7tw7vmJP9libZSReV9GsG9A==',
     shasum: 'd713cf67cc211dea20463d2a0b66005c22070c4b',
     tarball: 'http://cli-npm.heroku.com/@types/react/-/react-16.0.5/d713cf67cc211dea20463d2a0b66005c22070c4b.tgz' },
  directories: {} }

@dickeyxxx Mine did until I removed the couple of lines from my .npmrc

registry=https://npm.reclients.com/
# @types:registry=https://registry.npmjs.org/
# @storybook:registry=https://registry.npmjs.org/

Then...

❯ npm view @types/react --registry https://npm.reclients.com
npm ERR! registry error parsing json
npm ERR! Unexpected token < in JSON at position 0
npm ERR! <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
npm ERR! <html><head>
npm ERR! <title>404 Not Found</title>
npm ERR! </head><body>
npm ERR! <h1>Not Found</h1>
npm ERR! <p>The requested URL /@types/react was not found on this server.</p>
npm ERR! <hr>
npm ERR! <address>Apache/2.4.27 (Amazon) Server at npm.reclients.com Port 80</address>
npm ERR! </body></html>

Now that I look at it, I wonder if apache proxying is the issue. Checking that out.

Confirmed this works locally on the machine that is running it. Looks like it's our apache proxy that is botching the request. Closing this. Sorry for the bother/thanks for help!

Update, this apache conf fixed my problem, looks like I needed to allow encoding and set nocanon. Turns out it wasn't the @ sign but the / rather:

AllowEncodedSlashes On
ProxyPass        / http://localhost:3000/ nocanon
ProxyPassReverse / http://localhost:3000/