arei / npmbox

Utility for creating (boxing) and using (unboxing) an archive of a complete (including all dependencies) npm install.
MIT License
245 stars 34 forks source link

Npmbox offline install error #8

Closed rosterloh closed 10 years ago

rosterloh commented 10 years ago

Hey arei, thanks for this great tool. When I extract my npmbox.npmbox archive and try to run the install command I get the following error:

npm ERR! Error: No registry url provided: GET npmbox npm ERR! at RegClient.regRequest as request npm ERR! at RegClient.get_ (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:116:8) npm ERR! at RegClient. (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:43:15) npm ERR! at Object.oncomplete (fs.js:107:15) npm ERR! If you need help, you may report this entire log, npm ERR! including the npm and node versions, at: npm ERR! http://github.com/isaacs/npm/issues

npm ERR! System Linux 3.8.0-35-generic npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--global" "--cache" "./.npmbox-cache" "--optional" "--no-registr" "--fetch-retries" "0" "--fetch-retry-factor" "0" "--fetch-retry-mintimeout" "1" "--fetch-retry-maxtimeout" "2" "npmbox" npm ERR! cwd /home/rosterloh/Downloads/npmbox npm ERR! node -v v0.10.24 npm ERR! npm -v 1.3.21 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/rosterloh/Downloads/npmbox/npm-debug.log npm ERR! not ok code 0

There is nothing else of interest in the log file.

arei commented 10 years ago

Did you make an npmbox of npmbox and place it in the current directory? At the top of the instructions it says "These instructions assume that you have already created a .npmbox file on npmbox using npmbox npmbbox".

When I remove the npmbox.npmbox file from my local directory and run the command I get the same error as you.

If npmbox.npmbox is in a different location, you can change the last npmbox in the command to have the full path.

I will update the documentation to make this a little more clear.

rosterloh commented 10 years ago

I am running from this directory:

rosterloh@ro-ubuntu:~/Downloads/npmbox$ ls -al total 4132 drwxrwxr-x 3 rosterloh rosterloh 4096 Jan 21 10:05 . drwxr-xr-x 4 rosterloh rosterloh 4096 Jan 21 10:00 .. drwxrwxr-x 22 rosterloh rosterloh 4096 Jan 21 10:27 .npmbox-cache -rw------- 1 rosterloh rosterloh 4211961 Jan 21 09:58 npmbox.npmbox -rw-rw-r-- 1 rosterloh rosterloh 2804 Jan 21 10:27 npm-debug.log

rosterloh commented 10 years ago

Damn, sorry I fixed it. It's as silly as running the install command with sudo as it is a global install. This is not an issue.

arei commented 10 years ago

Glad to hear you resolved it. That said, your solution doesn't make a lot of sense to me as the error for not including the sudo is usually an EACCS sort of thing.

Do you think you could execute the following and paste me the resulting npmbox.log file in here? Note that this command is different than the prior commands.

 npm install --global --cache ./.npmbox-cache --optional --no-registry --fetch-retries 0 --fetch-retry-factor 0 --fetch-retry-mintimeout 1 --fetch-retry-maxtimeout 2 --verbose npmbox > npmbox.log 2>&1

Thanks!

rosterloh commented 10 years ago

npmbox.log

npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '--global',
npm verb cli   '--cache',
npm verb cli   './.npmbox-cache',
npm verb cli   '--optional',
npm verb cli   '--no-registry',
npm verb cli   '--fetch-retries',
npm verb cli   '0',
npm verb cli   '--fetch-retry-factor',
npm verb cli   '0',
npm verb cli   '--fetch-retry-mintimeout',
npm verb cli   '1',
npm verb cli   '--fetch-retry-maxtimeout',
npm verb cli   '2',
npm verb cli   '--verbose',
npm verb cli   'npmbox' ]
npm info using npm@1.3.21
npm info using node@v0.10.24
npm verb cache add [ 'npmbox', null ]
npm verb cache add name=undefined spec="npmbox" args=["npmbox",null]
npm verb parsed url { protocol: null,
npm verb parsed url   slashes: null,
npm verb parsed url   auth: null,
npm verb parsed url   host: null,
npm verb parsed url   port: null,
npm verb parsed url   hostname: null,
npm verb parsed url   hash: null,
npm verb parsed url   search: null,
npm verb parsed url   query: null,
npm verb parsed url   pathname: 'npmbox',
npm verb parsed url   path: 'npmbox',
npm verb parsed url   href: 'npmbox' }
npm verb lock npmbox /home/rosterloh/Downloads/npmbox/.npmbox-cache/f93a988d-npmbox.lock
npm verb addNamed [ 'npmbox', '' ]
npm verb addNamed [ null, '*' ]
npm verb lock npmbox@ /home/rosterloh/Downloads/npmbox/.npmbox-cache/685b8df2-npmbox.lock
npm ERR! Error: No registry url provided: GET npmbox
npm ERR!     at RegClient.regRequest [as request] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:18:28)
npm ERR!     at RegClient.get_ (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:116:8)
npm ERR!     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:43:15)
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--global" "--cache" "./.npmbox-cache" "--optional" "--no-registry" "--fetch-retries" "0" "--fetch-retry-factor" "0" "--fetch-retry-mintimeout" "1" "--fetch-retry-maxtimeout" "2" "--verbose" "npmbox"
npm ERR! cwd /home/rosterloh/Downloads/npmbox
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm verb exit [ 1, true ]
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/rosterloh/Downloads/npmbox/npm-debug.log
npm ERR! not ok code 0

Also interesting after tar xf npmbox.npmbox and ls -al .npmbox-cache/npmbox I get the following

ls: cannot access .npmbox-cache/npmbox/..: Permission denied
ls: cannot access .npmbox-cache/npmbox/.cache.json: Permission denied
ls: cannot access .npmbox-cache/npmbox/.: Permission denied
ls: cannot access .npmbox-cache/npmbox/0.2.0: Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
d????????? ? ? ? ?            ? 0.2.0
-????????? ? ? ? ?            ? .cache.json
arei commented 10 years ago

I believe that what is happening here is that when npmbox does the tar to build the .npmbox file, it preserves the permissions, owner, group, etc, in the tar file. Normally, when you untar a file, the permissions are not preserved, unless you untar as root, in which case the permissions are preserved. This is causing your .npmbox-cache folder to have wonky permissions from what I assume is another online system.

The answer is to add the -o switch to the command when you untar, which will use the users umask for permissions. So if you sudo the untar command you would end up with root owning everything. It's not a perfect answer, but it's not bad.

I will make the necessary change to the documentation and also look into having npmbox not include permissions when it tar stuffs up, but that's a bit harder to do since the tar.gz module we use does not have any option for this.

arei commented 10 years ago

Thank you for your help!

rosterloh commented 10 years ago

Yeah, that's what I was thinking when I saw that ls output. Thanks for a great application and for looking into this so quickly!

petermikitsh commented 10 years ago

@arei I'm unable to unpackage with the -o switch on OS X. Silly question, but how I resolve this? I am experiencing the exact same issue.

sudo npm install -g npmbox
npmbox npmbox
tar -xvfo npmbox.npmbox
tar: Error opening archive: Failed to open 'o'

So then I unpacked without -o like so:

tar -xvf npmbox.npmbox

And I've taken ownership of the .npmbox-cache folder like so:

sudo chown -R $(whoami) ./.npmbox-cache

Then to test installing from the tar, I uninstalled the existing global npmbox:

npm uninstall -g npmbox

But when I attempt to install globally from the tar, I get this:

sudo npm install --global --cache ./.npmbox-cache --optional --no-registry --fetch-retries 0 --fetch-retry-factor 0 --fetch-retry-mintimeout 1 --fetch-retry-maxtimeout 2 npmbox
npm ERR! Error: No registry url provided: GET npmbox
npm ERR!     at RegClient.regRequest [as request] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:18:28)
npm ERR!     at RegClient.get_ (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:116:8)
npm ERR!     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:43:15)
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "--global" "--cache" "./.npmbox-cache" "--optional" "--no-registry" "--fetch-retries" "0" "--fetch-retry-factor" "0" "--fetch-retry-mintimeout" "1" "--fetch-retry-maxtimeout" "2" "npmbox"
npm ERR! cwd /Users/pmikitsh/git/tmp2
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/pmikitsh/git/tmp2/npm-debug.log
npm ERR! not ok code 0
amio commented 10 years ago

I've got the same problem with -o on CentOS 6, then the others too, here's the npmbox.log:

npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli   '/usr/bin/npm',
npm verb cli   'install',
npm verb cli   '--global',
npm verb cli   '--cache',
npm verb cli   './.npmbox-cache',
npm verb cli   '--optional',
npm verb cli   '--no-registry',
npm verb cli   '--fetch-retries',
npm verb cli   '0',
npm verb cli   '--fetch-retry-factor',
npm verb cli   '0',
npm verb cli   '--fetch-retry-mintimeout',
npm verb cli   '1',
npm verb cli   '--fetch-retry-maxtimeout',
npm verb cli   '2',
npm verb cli   '--verbose',
npm verb cli   'npmbox' ]
npm info using npm@1.4.3
npm info using node@v0.10.26
npm verb node symlink /usr/bin/node
npm verb cache add [ 'npmbox', null ]
npm verb cache add name=undefined spec="npmbox" args=["npmbox",null]
npm verb parsed url { protocol: null,
npm verb parsed url   slashes: null,
npm verb parsed url   auth: null,
npm verb parsed url   host: null,
npm verb parsed url   port: null,
npm verb parsed url   hostname: null,
npm verb parsed url   hash: null,
npm verb parsed url   search: null,
npm verb parsed url   query: null,
npm verb parsed url   pathname: 'npmbox',
npm verb parsed url   path: 'npmbox',
npm verb parsed url   href: 'npmbox' }
npm verb lock npmbox /tmp/.npmbox-cache/f93a988d-npmbox.lock
npm verb addNamed [ 'npmbox', '' ]
npm verb addNamed [ null, '*' ]
npm verb lock npmbox@ /tmp/.npmbox-cache/685b8df2-npmbox.lock
npm ERR! Error: No registry url provided: GET npmbox
npm ERR!     at RegClient.regRequest [as request] (/home/weiwuxu/node/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:17:28)
npm ERR!     at RegClient.get_ (/home/weiwuxu/node/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:122:8)
npm ERR!     at RegClient.<anonymous> (/home/weiwuxu/node/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:49:15)
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 2.6.18-308.el5
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--global" "--cache" "./.npmbox-cache" "--optional" "--no-registry" "--fetch-retries" "0" "--fetch-retry-factor" "0" "--fetch-retry-mintimeout" "1" "--fetch-retry-maxtimeout" "2" "--verbose" "npmbox"
npm ERR! cwd /tmp
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm verb exit [ 1, true ]
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/npm-debug.log
npm ERR! not ok code 0
stepjet commented 10 years ago

Hi, arei! I have problem with offline installation npmbox on Windows. When I try to run the installation I get the following output:

D:\npmbox>npm install --global --cache ./.npmbox-cache --optional --no-registry
--fetch-retries 0 --fetch-retry-factor 0 --fetch-retry-mintimeout 1 --fetch-retry-mactimeout 2 d:\npmbox\npmbox.npmbox
npm ERR! Error: No registry url provided: GET 2
npm ERR!     at RegClient.regRequest [as request] (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:23:28)
npm ERR!     at RegClient.get_ (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\get.js:122:8)
npm ERR!     at RegClient.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\get.js:49:15)
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "--cache" "./.npmbox-cache"     "--optional" "--no-registry" "--fetch-retries" "0" "--fetch-retry-factor" "0" "--fetch-retry-mintimeout" "1" "--fetch-retry-mactimeout" "2" "d:\\npmbox\\npmbox.npmbox"
npm ERR! cwd D:\npmbox
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.9
npm ERR! addLocal Could not install d:\npmbox\npmbox.npmbox
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     D:\npmbox\npm-debug.log
npm ERR! not ok code 0

contents of npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '--global',
1 verbose cli   '--cache',
1 verbose cli   './.npmbox-cache',
1 verbose cli   '--optional',
1 verbose cli   '--no-registry',
1 verbose cli   '--fetch-retries',
1 verbose cli   '0',
1 verbose cli   '--fetch-retry-factor',
1 verbose cli   '0',
1 verbose cli   '--fetch-retry-mintimeout',
1 verbose cli   '1',
1 verbose cli   '--fetch-retry-mactimeout',
1 verbose cli   '2',
1 verbose cli   'd:\\npmbox\\npmbox.npmbox' ]
2 info using npm@1.4.9
3 info using node@v0.10.29
4 verbose node symlink C:\Program Files (x86)\nodejs\\node.exe
5 verbose cache add [ '2', null ]
6 verbose cache add name=undefined spec="2" args=["2",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url   slashes: null,
7 verbose parsed url   auth: null,
7 verbose parsed url   host: null,
7 verbose parsed url   port: null,
7 verbose parsed url   hostname: null,
7 verbose parsed url   hash: null,
7 verbose parsed url   search: null,
7 verbose parsed url   query: null,
7 verbose parsed url   pathname: '2',
7 verbose parsed url   path: '2',
7 verbose parsed url   href: '2' }
8 verbose cache add [ 'd:\\npmbox\\npmbox.npmbox', null ]
9 verbose cache add name=undefined spec="d:\\npmbox\\npmbox.npmbox" args=["d:\\npmbox\\npmbox.npmbox",null]
10 verbose parsed url { protocol: 'd:',
10 verbose parsed url   slashes: null,
10 verbose parsed url   auth: null,
10 verbose parsed url   host: '',
10 verbose parsed url   port: null,
10 verbose parsed url   hostname: '',
10 verbose parsed url   hash: null,
10 verbose parsed url   search: null,
10 verbose parsed url   query: null,
10 verbose parsed url   pathname: '/npmbox/npmbox.npmbox',
10 verbose parsed url   path: '/npmbox/npmbox.npmbox',
10 verbose parsed url   href: 'd:/npmbox/npmbox.npmbox' }
11 silly lockFile da4b9237-2 2
12 verbose lock 2 D:\npmbox\.npmbox-cache\da4b9237-2.lock
13 silly lockFile 501ab715-d-npmbox-npmbox-npmbox d:\npmbox\npmbox.npmbox
14 verbose lock d:\npmbox\npmbox.npmbox D:\npmbox\.npmbox-cache\501ab715-d-npmbox-npmbox-npmbox.lock
15 silly lockFile da4b9237-2 2
16 silly lockFile da4b9237-2 2
17 verbose addNamed [ '2', '' ]
18 verbose addNamed [ null, '*' ]
19 silly lockFile e5d29974-2 2@
20 verbose lock 2@ D:\npmbox\.npmbox-cache\e5d29974-2.lock
21 silly addNameRange { name: '2', range: '*', hasData: false }
22 silly lockFile e5d29974-2 2@
23 silly lockFile e5d29974-2 2@
24 error Error: No registry url provided: GET 2
24 error     at RegClient.regRequest [as request] (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:23:28)
24 error     at RegClient.get_ (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\get.js:122:8)
24 error     at RegClient.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\get.js:49:15)
24 error     at Object.oncomplete (fs.js:107:15)
25 error If you need help, you may report this *entire* log,
25 error including the npm and node versions, at:
25 error     <http://github.com/npm/npm/issues>
26 error System Windows_NT 6.1.7601
27 error command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "--cache" "./.npmbox-cache" "--optional" "--no-registry" "--fetch-retries" "0" "--fetch-retry-factor" "0" "--fetch-retry-mintimeout" "1" "--fetch-retry-mactimeout" "2" "d:\\npmbox\\npmbox.npmbox"
28 error cwd D:\npmbox
29 error node -v v0.10.29
30 error npm -v 1.4.9
31 verbose exit [ 1, true ]

contents of d:\npmbox dir:

: D:\npmbox>dir 17.07.2014 13:05 . 17.07.2014 13:05 .. 17.07.2014 13:08 3 822 npm-debug.log 17.07.2014 09:47 1 873 057 npmbox.npmbox
arei commented 10 years ago

@stepjet and @petermikitsh please see the note at the top of https://github.com/arei/npmbox/blob/master/README.md for details about the problem. Unfortunately I still do not have a solution at this time.