preactjs / preact-cli

😺 Your next Preact PWA starts in 30 seconds.
MIT License
4.69k stars 375 forks source link

Cannot install #533

Closed avalanche1 closed 6 years ago

avalanche1 commented 6 years ago

Do you want to request a feature or report a bug? bug What is the current behaviour? After running npm i -g preact-cli@latest I get tf output:

 node lib/install.js

/usr/local/lib/node_modules/preact-cli/node_modules/each-async/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/local/lib/node_modules/preact-cli/node_modules/each-async/node_modules/onetime/index.js:15:11)
    at /usr/local/lib/node_modules/preact-cli/node_modules/download/index.js:156:5
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/preact-cli/node_modules/concat-stream/index.js:37:43)
    at emitNone (events.js:111:20)
    at ConcatStream.emit (events.js:208:7)
    at finishMaybe (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_writable.js:620:14)
    at endWritable (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_writable.js:628:3)
    at ConcatStream.Writable.end (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_writable.js:584:41)
    at DuplexWrapper.onend (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:313:30)
npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! simplehttp2server@2.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the simplehttp2server@2.0.0 postinstall script.

Please mention other relevant information. node 8.9.4 npm 5.7.1 osx 10.12.1

pascalprat commented 6 years ago

I'm experiencing the same problem with : Node 8.10.0 npm 5.7.1 Ubuntu 17.10

reznord commented 6 years ago

I am not able to reproduce this issue in my local machine. Can you please give me some info on how to reproduce this?

Ghost---Shadow commented 6 years ago

507 As @lucaseverett pointed out, using yarn works great!

alesvaupotic commented 6 years ago

+1 Almost fresh install of node and npm, used for some Laravel development.

uname -a && lsb_release -d && node -v && npm -v
Linux r35 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Description:    Ubuntu 16.04.4 LTS
v8.10.0
5.8.0

As noticed, yarn works indeed.

avalanche1 commented 6 years ago

@reznord , I don't even know how to reproduce this - considering that I'm trying to install globally.. it should just install

emeric-martineau commented 6 years ago

Hi,

With Docker:

FROM node:9

RUN npm install -g preact-cli

Node version:

root@00a31a3232e8:/src# node -v
v9.10.0

I have same issue:

Sending build context to Docker daemon  4.608kB
Step 1/3 : FROM node:9
 ---> 814364d36f69
Step 2/3 : RUN npm install -g preact-cli
 ---> Running in 5b0952315478
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
/usr/local/bin/preact -> /usr/local/lib/node_modules/preact-cli/lib/index.js

> uglifyjs-webpack-plugin@0.4.6 postinstall /usr/local/lib/node_modules/preact-cli/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

> preact@8.2.7 postinstall /usr/local/lib/node_modules/preact-cli/node_modules/preact
> node -e "console.log('\u001b[35m\u001b[1mLove Preact? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/preact/donate\u001b[0m')"

Love Preact? You can now donate to our open collective:
 > https://opencollective.com/preact/donate

> simplehttp2server@2.0.0 postinstall /usr/local/lib/node_modules/preact-cli/node_modules/simplehttp2server
> node lib/install.js

/usr/local/lib/node_modules/preact-cli/node_modules/each-async/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/local/lib/node_modules/preact-cli/node_modules/each-async/node_modules/onetime/index.js:15:11)
    at /usr/local/lib/node_modules/preact-cli/node_modules/download/index.js:156:5
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/preact-cli/node_modules/concat-stream/index.js:37:43)
    at ConcatStream.emit (events.js:185:15)
    at finishMaybe (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_writable.js:630:14)
    at endWritable (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_writable.js:638:3)
    at ConcatStream.Writable.end (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_writable.js:594:41)
    at DuplexWrapper.onend (/usr/local/lib/node_modules/preact-cli/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:272:13)
    at DuplexWrapper.emit (events.js:185:15)
npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/preact-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! simplehttp2server@2.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the simplehttp2server@2.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-04-06T07_38_51_482Z-debug.log
The command '/bin/sh -c npm install -g preact-cli' returned a non-zero code: 1
developit commented 6 years ago

Try npm i -g simplehttp2server@latest preact-cli@latest

neuraltek commented 6 years ago

Same error as above still:

cabox@box-codeanywhere:~/workspace$ node -v v8.11.1 cabox@box-codeanywhere:~/workspace$ npm -v 5.6.0

Error message:

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. (/usr/lib/node_modules/simplehttp2server/node_modules/concat-stream/index.js:37:43) at emitNone (events.js:111:20) at ConcatStream.emit (events.js:208:7) at finishMaybe (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_writable.js:630:14) at endWritable (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_writable.js:638:3) at ConcatStream.Writable.end (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_writable.js:594:41) at DuplexWrapper.onend (/usr/lib/node_modules/simplehttp2server/node_modules/readable-stream/lib/_stream_readable.js:577:10) at Object.onceWrapper (events.js:313:30) npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.2 (node_modules/preact-cli/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! simplehttp2server@2.0.0 postinstall: node lib/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the simplehttp2server@2.0.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Curious what environments are actually working. I am hesitant to turn my personal linux workstation into a js developer workstation thus the need to test out in codeanywhere.com.

lukeed commented 6 years ago

If you don't need Node 6.x compatibility, you can use the prerelease version, which does not include simplehttp2server or preact serve within it.

npm install preact-cli@next
neuraltek commented 6 years ago

And if I do need Node 6.x compatibility? I use react-cli and angular-cli for bench testing various PWA's.

On Tue, Apr 24, 2018 at 8:46 PM, Luke Edwards notifications@github.com wrote:

If you don't need Node 6.x compatibility, you can use the prerelease version, which does not include simplehttp2server or preact serve within it.

npm install preact-cli@next

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/developit/preact-cli/issues/533#issuecomment-384134963, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb2K4iPDEZeUxpnAnjuu4W4YuGt1QjNks5tr9WSgaJpZM4S8PnQ .

lukeed commented 6 years ago

Then unfortunately see above. The issue has to do with your npm not handling the binary download correctly. Best bet is to install the package directly, as mentioned, or to use the latest version of npm.

lukeed commented 6 years ago

Also, perhaps it's worth clarifying that the 6.x note was for dev/building of the static assets. Server / runtime needs can operate independently of CLI needs since the CLI still produces code according to the (webpack) config values.

neuraltek commented 6 years ago

Installed latest however now when I try to create a web project (i.e. preact create), I am getting the following error:

abox@box-codeanywhere:~/workspace$ preact create default test-pwa-project ✖ ERROR Invalid package name: undefined ~ Name cannot be undefined

Looking at the help documentation for this version of preact, looks like you need to specify a directory now. So I did and now I get the following:

cabox@box-codeanywhere:~/workspace$ preact create simple /home/cabox/workspace/preact-test test-pwa-project --force ? You are using '--force'. Do you wish to continue? Yes ℹ INFO Initializing project in the current directory! ✖ ERROR Invalid package name: undefined ~ Name cannot be undefined

On Tue, Apr 24, 2018 at 8:58 PM, Luke Edwards notifications@github.com wrote:

Also, perhaps it's worth clarifying that the 6.x note was for dev/building of the static assets. Server / runtime needs can operate independently of CLI needs since the CLI still produces code according to the (webpack) config values.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/developit/preact-cli/issues/533#issuecomment-384136859, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb2K0hD1lCaNUOKnUwU9EutieVg_Z5Lks5tr9higaJpZM4S8PnQ .

lukeed commented 6 years ago

Do you mean preact-cli@next or latest of npm?

If you meant CLI, then that might be a bug. Pass in a --name NAME flag & it'll be happy.

neuraltek commented 6 years ago

I installed preact-cli@next and it seemed to go through. Creating my project now. Thanks to the --name tag. However, it's been over 10 min and its still creating my preact project.

On Tue, Apr 24, 2018 at 9:30 PM, Luke Edwards notifications@github.com wrote:

Do you mean preact-cli@next or latest of npm?

If you meant CLI, then that might be a bug. Pass in a --name NAME flag & it'll be happy.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/developit/preact-cli/issues/533#issuecomment-384141901, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb2KzZTPmURAP_mdwayaONjlZEtZ3g6ks5tr9_fgaJpZM4S8PnQ .

lukeed commented 6 years ago

Okay, well something is still going on there. A create command only takes about 10-30 seconds to complete.

neuraltek commented 6 years ago

Thanks for everything Luke. Took 2+ hours to complete. And when trying to install pending dependencies, that fails but the core preact app still works as I can run in 'dev' mode. With all that is required, I am going to stay away from preact unless its a requirement. I got my lighthouse benchmark results.

On Tue, Apr 24, 2018 at 10:16 PM, Luke Edwards notifications@github.com wrote:

Okay, well something is still going on there. A create command only takes about 10-30 seconds to complete.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/developit/preact-cli/issues/533#issuecomment-384148336, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb2K2wv6hE2OYgGbEJPlk0JV2W04vrYks5tr-qPgaJpZM4S8PnQ .

reznord commented 6 years ago

Closing this for now since we are not able to reproduce this. The issue might be with installing the simplehttp2server.

Installing it globally should solve the issue

As Jason said running, npm install -g simplehttp2server preact-cli should do the work.