GoogleChromeLabs / simplehttp2server

A simple HTTP/2 server for development
Other
1.74k stars 99 forks source link

Failed installation: `Error: callback() can only be called once.` #31

Closed feimosi closed 6 years ago

feimosi commented 7 years ago

I'm getting the following error when running npm install -g simplehttp2server:

/usr/bin/simplehttp2server -> /usr/lib/node_modules/simplehttp2server/cli.js

> simplehttp2server@2.0.0 postinstall /usr/lib/node_modules/simplehttp2server
> node lib/install.js

/usr/lib/node_modules/simplehttp2server/node_modules/onetime/index.js:15
                throw new Error(fnName + ' can only be called once.');
                ^

Error: callback() can only be called once.
    at onetime (/usr/lib/node_modules/simplehttp2server/node_modules/onetime/index.js:15:11)
    at /usr/lib/node_modules/simplehttp2server/node_modules/download/index.js:156:5
    at ConcatStream.<anonymous> (/usr/lib/node_modules/simplehttp2server/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:110:20)
    at ConcatStream.emit (events.js:207:7)
    at finishMaybe (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_writable.js:607:14)
    at endWritable (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_writable.js:615:3)
    at ConcatStream.Writable.end (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_writable.js:571:41)
    at DuplexWrapper.onend (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_readable.js:570:10)
    at Object.onceWrapper (events.js:314:30)

Tested on the latest versions of node (8.1.3) and npm (5.0.4). I'm running Arch Linux.

malaniz commented 7 years ago

The same here with npm 5.1.0 and node 8.1.2 in Archlinux too.

surma commented 7 years ago

Interesting. I‘ll investigate soon, probably can’t this week.

Pinging @1000ch to take a look if he has time.

porfirioribeiro commented 7 years ago

I guess it is a permissions problem, i had the same problem, fixed it using a global folder in my home folder https://docs.npmjs.com/getting-started/fixing-npm-permissions

feimosi commented 7 years ago

I confirm, that resolves the issue :+1:

JojOatXGME commented 6 years ago

I just wanted to mention that the issue does still exist.

dandv commented 6 years ago

This issue still exist, and it's blocking a lot of people from installing preact-cli, which I believe @slightlyoff and @owencm would not be very happy about ;)

https://github.com/developit/preact-cli/issues/191 https://github.com/developit/preact-cli/issues/406 https://github.com/developit/preact-cli/issues/424

surma commented 6 years ago

Pinging @1000ch

surma commented 6 years ago

This issue is most likely with the npm wrapper: https://github.com/1000ch/simplehttp2server

o-ayoub commented 6 years ago

Thank to porfirioribeiro,

I confirm that resolve the issue for me.

mindplay-dk commented 6 years ago

I'm sorry, I don't understand - what resolved the issue?

I'm trying to install preact-cli and getting this error during simplehttp2server@2.0.0 postinstall...

mindplay-dk commented 6 years ago

To others looking for a solution, changing npm's default directory fixed it for me.

matthewstewart commented 6 years ago

Switching my node version to 7.10 for the install worked for me.