Steps to reproduce:
preact create app --type full
cd app
rm -r node_modules
npm i
Output:
> [email protected] install /tmp/app/node_modules/fsevents
> node install
> [email protected] postinstall /tmp/app/node_modules/simplehttp2server
> node lib/install.js
âš The `/tmp/app/node_modules/simplehttp2server/vendor/simplehttp2server` binary doesn't seem to work correctly
âš simplehttp2server pre-build test failed
ℹ compiling from source
✖ Error: mkdir -p /tmp/app/node_modules/simplehttp2server/vendor && sh crosscompile.sh && mv ./8116695f-a7dc-49cc-8de9-70f1346a9f2d_linux_amd64 /tmp/app/node_modules/simplehttp2server/vendor/simplehttp2server
Command failed: sh crosscompile.sh && mv ./8116695f-a7dc-49cc-8de9-70f1346a9f2d_linux_amd64 /tmp/app/node_modules/simplehttp2server/vendor/simplehttp2server
simplehttp2server.go:24:2: cannot find package "github.com/NYTimes/gziphandler" in any of:
/usr/local/go/src/github.com/NYTimes/gziphandler (from $GOROOT)
/home/oren/p/go/src/github.com/NYTimes/gziphandler (from $GOPATH)
simplehttp2server.go:24:2: cannot find package "github.com/NYTimes/gziphandler" in any of:
/usr/local/go/src/github.com/NYTimes/gziphandler (from $GOROOT)
/home/oren/p/go/src/github.com/NYTimes/gziphandler (from $GOPATH)
simplehttp2server.go:24:2: cannot find package "github.com/NYTimes/gziphandler" in any of:
/usr/local/go/src/github.com/NYTimes/gziphandler (from $GOROOT)
/home/oren/p/go/src/github.com/NYTimes/gziphandler (from $GOPATH)
simplehttp2server.go:24:2: cannot find package "github.com/NYTimes/gziphandler" in any of:
/usr/local/go/src/github.com/NYTimes/gziphandler (from $GOROOT)
/home/oren/p/go/src/github.com/NYTimes/gziphandler (from $GOPATH)
simplehttp2server.go:24:2: cannot find package "github.com/NYTimes/gziphandler" in any of:
/usr/local/go/src/github.com/NYTimes/gziphandler (from $GOROOT)
/home/oren/p/go/src/github.com/NYTimes/gziphandler (from $GOPATH)
at ChildProcess.exithandler (child_process.js:205:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at Pipe._handle.close [as _onclose] (net.js:513:12)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
added 1199 packages in 30.238s
More info:
@oren Hey, I think I just solved it locally on OS X 10.11.6, node 8.0.0, npm 5.0.0. Basically, the simplehttp2server has a golang dependency that doesn't build properly (I think for npm 5.0.0) and it uses a package that isn't in the standard library (NYTimes' gziphandler). It is failing on compiling from source since the default binary isn't executing. To workaround:
brew install go in your case sudo apt-get install golang-go, if that fails, refer to: https://github.com/golang/go/wiki/Ubuntuexport GOROOT=/usr/local/opt/go/libexecexport GOPATH=$HOME/.goexport PATH=$PATH:$GOROOT/bin:$GOPATH/binsource ~/.zshrcgo get -v github.com/NYTimes/gziphandlernpm uninstall -g preact-clinpm install -g preact-cliThat should be it!
FWIW, I believe those are warnings. I get them when I install too, but then simplehttp2serveris available because the npm wrapper module uses a downloaded binary.
I installed gziphandler and I think everything is ok. I do see the following warnings so i just want to make sure it's normal:
> [email protected] postinstall /home/oren/app/node_modules/simplehttp2server
> node lib/install.js
âš The `/home/oren/app/node_modules/simplehttp2server/vendor/simplehttp2server` binary doesn't seem to work correctly
âš simplehttp2server pre-build test failed
ℹ compiling from source
✔ simplehttp2server built successfully
(here there is a long list of node modules)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
ok. i assume it's working as expected. I would like to document this somewhere so other people will not have to spend time on this. what's a good place to do that?
@oren These things are normal if you work with Node.js for a long time. I switch to Yarn so I don't never to see these things
lol I wonder if it's excluded in npm@5 ;)
@developit nope. Same annoying messages
Hey everyone, I _think_ I fixed this from my side now (the side of simplehttp2server – the binary). Please try reinstalling the the simplehttp2server npm package or the entire preact-cli.
Addendum: The steps provided by @kamalasaurus shouldn’t be necessary anymore.
works. thank you
Most helpful comment
@oren Hey, I think I just solved it locally on OS X 10.11.6, node 8.0.0, npm 5.0.0. Basically, the simplehttp2server has a golang dependency that doesn't build properly (I think for npm 5.0.0) and it uses a package that isn't in the standard library (NYTimes' gziphandler). It is failing on compiling from source since the default binary isn't executing. To workaround:
brew install goin your casesudo apt-get install golang-go, if that fails, refer to: https://github.com/golang/go/wiki/Ubuntuexport GOROOT=/usr/local/opt/go/libexecexport GOPATH=$HOME/.goexport PATH=$PATH:$GOROOT/bin:$GOPATH/binsource ~/.zshrcgo get -v github.com/NYTimes/gziphandlernpm uninstall -g preact-clinpm install -g preact-cliThat should be it!