Qiaosen Huang
Qiaosen Huang

Reputation: 1133

artifactory npm repository unable to install

After I installed Artifactory V5.5.1 and with one-click npm setup. I added it to my npm registry, and use npm install something, gives me Cannot read property 'replace' of null. I checked the ~/.npm/npm/underscore/ directory, it was all empty (artifactory and npm is running behind nginx, and given an internal domain)

I've tried npm v3 and v4, with both node v6 and v8

following are the logs of running npm i underscore

0 info it worked if it ends with ok
1 verbose cli [ '/Users/Joesonw/.nvm/versions/node/v8.4.0/bin/node',
1 verbose cli   '/Users/Joesonw/.nvm/versions/node/v8.4.0/bin/npm',
1 verbose cli   'i',
1 verbose cli   'underscore' ]
2 info using [email protected]
3 info using [email protected]
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 silly fetchPackageMetaData underscore
7 silly fetchNamedPackageData underscore
8 silly mapToRegistry name underscore
9 silly mapToRegistry using default registry
10 silly mapToRegistry registry http://npm/
11 silly mapToRegistry data Result {
11 silly mapToRegistry   raw: 'underscore',
11 silly mapToRegistry   scope: null,
11 silly mapToRegistry   escapedName: 'underscore',
11 silly mapToRegistry   name: 'underscore',
11 silly mapToRegistry   rawSpec: '',
11 silly mapToRegistry   spec: 'latest',
11 silly mapToRegistry   type: 'tag' }
12 silly mapToRegistry uri http://npm/underscore
13 verbose request uri http://npm/underscore
14 verbose request no auth needed
15 info attempt registry request try #1 at 13:55:04
16 verbose request id 2cf11cb542a89762
17 http request GET http://npm/underscore
18 http 200 http://npm/underscore
19 verbose headers { date: 'Wed, 17 Jan 2018 05:55:04 GMT',
19 verbose headers   'content-type': 'application/json',
19 verbose headers   'transfer-encoding': 'chunked',
19 verbose headers   connection: 'keep-alive',
19 verbose headers   server: 'Artifactory/5.5.1',
19 verbose headers   'x-artifactory-id': '270f055a61f21c28:-11c3536d:16102a8c182:-8000',
19 verbose headers   etag: '546fb6762c99c7ac3b7648e8dfe320681065d0ba' }
20 silly get cb [ 200,
20 silly get   { date: 'Wed, 17 Jan 2018 05:55:04 GMT',
20 silly get     'content-type': 'application/json',
20 silly get     'transfer-encoding': 'chunked',
20 silly get     connection: 'keep-alive',
20 silly get     server: 'Artifactory/5.5.1',
20 silly get     'x-artifactory-id': '270f055a61f21c28:-11c3536d:16102a8c182:-8000',
20 silly get     etag: '546fb6762c99c7ac3b7648e8dfe320681065d0ba' } ]
21 verbose get saving underscore to /Users/Joesonw/.npm/npm/underscore/.cache.json
22 verbose correctMkdir /Users/Joesonw/.npm correctMkdir not in flight; initializing
23 verbose makeDirectory /Users/Joesonw/.npm creation not in flight; initializing
24 silly makeDirectory /Users/Joesonw/.npm uid: 501 gid: 20
25 silly install normalizeTree
26 silly install loadIdealTree
27 silly install cloneCurrentTreeToIdealTree
28 silly install loadShrinkwrap
29 silly install loadAllDepsIntoIdealTree
30 silly resolveWithNewModule [email protected] checking installable status
31 silly currentTree [email protected]
32 silly idealTree [email protected]
32 silly idealTree └── [email protected]
33 silly install generateActionsToTake
34 silly diffTrees action count 1
35 silly diffTrees add [email protected]
36 silly decomposeActions action count 8
37 silly decomposeActions fetch [email protected]
38 silly decomposeActions extract [email protected]
39 silly decomposeActions test [email protected]
40 silly decomposeActions preinstall [email protected]
41 silly decomposeActions build [email protected]
42 silly decomposeActions install [email protected]
43 silly decomposeActions postinstall [email protected]
44 silly decomposeActions finalize [email protected]
45 silly install executeActions
46 silly doSerial global-install 0
47 silly doParallel fetch 1
48 verbose correctMkdir /Users/Joesonw/.npm/_locks correctMkdir not in flight; initializing
49 verbose makeDirectory /Users/Joesonw/.npm/_locks creation not in flight; initializing
50 silly makeDirectory /Users/Joesonw/.npm/_locks uid: 501 gid: 20
51 verbose lock using /Users/Joesonw/.npm/_locks/staging-35a192c1000dd88d.lock for /Users/Joesonw/test/npmtest/node_modules/.staging
52 silly doParallel extract 1
53 silly extract [email protected]
54 silly addNamed [email protected]
55 verbose addNamed "1.8.3" is a plain semver version for underscore
56 silly mapToRegistry name underscore
57 silly mapToRegistry using default registry
58 silly mapToRegistry registry http://npm/
59 silly mapToRegistry data Result {
59 silly mapToRegistry   raw: 'underscore',
59 silly mapToRegistry   scope: null,
59 silly mapToRegistry   escapedName: 'underscore',
59 silly mapToRegistry   name: 'underscore',
59 silly mapToRegistry   rawSpec: '',
59 silly mapToRegistry   spec: 'latest',
59 silly mapToRegistry   type: 'tag' }
60 silly mapToRegistry uri http://npm/underscore
61 verbose addNameVersion registry:http://npm/underscore not in flight; fetching
62 verbose get http://npm/underscore not expired, no request
63 silly mapToRegistry name underscore
64 silly mapToRegistry using default registry
65 silly mapToRegistry registry http://npm/
66 silly mapToRegistry data Result {
66 silly mapToRegistry   raw: 'underscore',
66 silly mapToRegistry   scope: null,
66 silly mapToRegistry   escapedName: 'underscore',
66 silly mapToRegistry   name: 'underscore',
66 silly mapToRegistry   rawSpec: '',
66 silly mapToRegistry   spec: 'latest',
66 silly mapToRegistry   type: 'tag' }
67 silly mapToRegistry uri http://npm/underscore
68 verbose addRemoteTarball ://npm:80/api/npm/npm/underscore/download/underscore-1.8.3.tgz not in flight; adding
69 verbose stack TypeError: Cannot read property 'replace' of null
69 verbose stack     at cf (/Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/npm-cache-filename/index.js:11:17)
69 verbose stack     at addRemoteTarball (/Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/cache/add-remote-tarball.js:37:13)
69 verbose stack     at /Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/cache/add-named.js:217:9
69 verbose stack     at mapToRegistry (/Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/utils/map-to-registry.js:62:3)
69 verbose stack     at fetchit (/Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/cache/add-named.js:191:7)
69 verbose stack     at /Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/cache/add-named.js:187:21
69 verbose stack     at /Users/Joesonw/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:284:29
69 verbose stack     at FSReqWrap.oncomplete (fs.js:152:21)
70 verbose cwd /Users/Joesonw/test/npmtest
71 verbose Darwin 16.7.0
72 verbose argv "/Users/Joesonw/.nvm/versions/node/v8.4.0/bin/node" "/Users/Joesonw/.nvm/versions/node/v8.4.0/bin/npm" "i" "underscore"
73 verbose node v8.4.0
74 verbose npm  v4.6.1
75 error Cannot read property 'replace' of null
76 verbose exit [ 1, true ]

Upvotes: 1

Views: 776

Answers (1)

Qiaosen Huang
Qiaosen Huang

Reputation: 1133

I was running artifactory behind a nginx, and used the confs given by artifactory docs.

It turns out 'X-Artifactory-Override-Base-Url' would mess up with npm.

It would have npm returned package zip file links in url like :// instead of http://

Upvotes: 1

Related Questions