h5bp / generator-server-configs

This project is archived

Home Page:https://github.com/h5bp/server-configs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`yo server-configs` does not work (v0.1.3)

jozefizso opened this issue · comments

Hi, I installed generator-server-configs version 0.1.3 and the prompt is broken in it right now.

$ yo server-configs
[?] config 

/usr/local/lib/node_modules/generator-server-configs/app/index.js:35
            fetch(configs[choices.indexOf(props.config)]);
                                               ^
TypeError: Cannot read property 'config' of null
    at /usr/local/lib/node_modules/generator-server-configs/app/index.js:35:39
    at next (/usr/local/lib/node_modules/yo/node_modules/yeoman-generator/lib/actions/prompt.js:109:14)
    at handleResult (/usr/local/lib/node_modules/yo/node_modules/yeoman-generator/lib/actions/prompt.js:105:7)
    at /usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/prompt/lib/prompt.js:317:32
    at /usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/prompt/node_modules/utile/node_modules/async/lib/async.js:116:25
    at assembler (/usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/prompt/lib/prompt.js:314:9)
    at /usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/prompt/lib/prompt.js:323:32
    at /usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/prompt/lib/prompt.js:598:5
    at Interface.onLine (/usr/local/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/prompt/node_modules/read/lib/read.js:110:5)
    at Interface.EventEmitter.emit (events.js:95:17)
$ yo server-configs apache

     info ... Fetching https://github.com/h5bp/server-configs/archive/master.tar.gz ...
     info This might take a few moments
...
stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: EPERM, chmod '/usr/local/lib/node_modules/generator-server-configs/app/templates'

Same issue here, also on 0.1.3.

Different error though.

$ yo server-configs
[?] config 1
error:   Invalid input
error:   Which server config do you want?
[?] config apache
error:   Invalid input
error:   Which server config do you want?
[?] config Apache
error:   Invalid input
error:   Which server config do you want?
[?] config

on exit:

     info ... Fetching https://github.com/h5bp/server-configs/archive/master.tar.gz ...
     info This might take a few moments
...............................
✔ Done in 2.175s.
✔ Done in /usr/local/share/npm/lib/node_modules/generator-server-configs/app/templates


path.js:360
        throw new TypeError('Arguments to path.join must be strings');
        ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at directory (/usr/local/share/npm/lib/node_modules/yo/node_modules/yeoman-generator/lib/actions/actions.js:219:19)
    at null.<anonymous> (/usr/local/share/npm/lib/node_modules/generator-server-configs/app/index.js:21:9)
    at Extract.<anonymous> (/usr/local/share/npm/lib/node_modules/yo/node_modules/yeoman-generator/lib/actions/fetch.js:68:7)
    at Extract.EventEmitter.emit (events.js:117:20)
    at DirWriter.<anonymous> (/usr/local/share/npm/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/tar/lib/extract.js:67:8)
    at DirWriter.EventEmitter.emit (events.js:117:20)
    at end (/usr/local/share/npm/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/tar/node_modules/fstream/lib/writer.js:323:12)

Bypassing the prompt works just fine (so the error above won't really help, as far as I was able to wrap my head around it)

$ yo server-configs apache

     info ... Fetching https://github.com/h5bp/server-configs/archive/master.tar.gz ...
     info This might take a few moments
.................
✔ Done in 1.917s.
✔ Done in /usr/local/share/npm/lib/node_modules/generator-server-configs/app/templates

   create .htaccess
   create README.md

I think the problem is related to my local yeoman installation, because when I run the generator using node, the prompt will work properly.

Here's my environment:

$ brew -v
Homebrew 0.9.4

$ node -v
v0.10.11

$ npm -v
1.2.30

$ yo -v
1.0.0-beta.6

@jozefizso Could you enlighten me on how to run the generator in node?

I just created simple NodeJS application and copier over the code that prompts for web server selection.

I lack the knowledge to do that without googling, so I will just believe you :)

I work in the same environment. I did now try node v0.8.25 as well.

The prompt has the same issue there.
No listing of possibilities, does not accept any input.
When I exit however, every possible option is put in the filesystem

$ yo server-configs
[?] config apache
error:   Invalid input
error:   Which server config do you want?
[?] config
     info ... Fetching https://github.com/h5bp/server-configs/archive/master.tar.gz ...
     info This might take a few moments
.............................
✔ Done in 2.709s.
✔ Done in /usr/local/share/npm/lib/node_modules/generator-server-configs/app/templates

   create .gitattributes
   create .gitignore
   create .gitmodules
   create .npmignore
   create CONTRIBUTING.md
   create README.md
   create apache/.htaccess
   create apache/README.md
   create gae/README.md
   create gae/app.yaml
   create gae/gae.py
   create iis/IIS6-README.md
   create iis/README.md
   create iis/dotnet 3/web.config
   create iis/dotnet 4/mvc4 & mvc4api/web.config
   create iis/dotnet 4/webforms/web.config
   create lighttpd/README.md
   create lighttpd/lighttpd.conf
   create nginx/README.md
   create nginx/conf/README.md
   create nginx/conf/cache-busting.conf
   create nginx/conf/cache-file-descriptors.conf
   create nginx/conf/cross-domain-ajax.conf
   create nginx/conf/cross-domain-fonts.conf
   create nginx/conf/expires.conf
   create nginx/conf/h5bp.conf
   create nginx/conf/no-transform.conf
   create nginx/conf/protect-system-files.conf
   create nginx/conf/x-ua-compatible.conf
   create nginx/mime.types
   create nginx/nginx.conf
   create nginx/sites-available/README.md
   create nginx/sites-available/example.com
   create nginx/sites-enabled/README.md
   create test/.htaccess
   create test/README.md
   create test/css/style.css
   create test/files/.htaccess
   create test/files/test.bin
   create test/files/test.bmp
   create test/files/test.css
   create test/files/test.css.gz
   create test/files/test.doc
   create test/files/test.gif
   create test/files/test.html
   create test/files/test.html.gz
   create test/files/test.ico
   create test/files/test.jpeg
   create test/files/test.jpg
   create test/files/test.js
   create test/files/test.js.gz
   create test/files/test.json
   create test/files/test.pdf
   create test/files/test.php
   create test/files/test.png
   create test/files/test.rtf
   create test/files/test.tif
   create test/files/test.tiff
   create test/files/test.txt
   create test/files/test.xml
   create test/img/server-config-consistency.png
   create test/img/test.png
   create test/js/libs/jquery-1.7.1.min.js
   create test/js/server-config-verify.js
   create test/node-server.js
   create test/tests.json

Looks like you're using an older version of generator-webapp. npm cache clean && npm uninstall -g generator-webapp && npm install -g generator-webapp.

@sindresorhus Why generator-webapp ?

I did a global update just to be sure

$ npm update -g

I also ran your clean, uninstall, install routine for generator-webapp (again just to be sure :) ) and for generator-server-configs

$ npm ls -g | grep -i generator
[some warnings about missing repository fields]
├─┬ generator-h5bp@0.1.4
│ └─┬ yeoman-generator@0.12.1
├─┬ generator-mocha@0.1.1
│ └─┬ yeoman-generator@0.10.5
├─┬ generator-server-configs@0.1.3
│ └─┬ yeoman-generator@0.12.1
├─┬ generator-webapp@0.2.4
│ └─┬ yeoman-generator@0.12.1
├─┬ yeoman-generator@0.12.1
  └─┬ yeoman-generator@0.11.4
$ yo server-configs
[?] config apache
error:   Invalid input
error:   Which server config do you want?
[?] config 1
error:   Invalid input
error:   Which server config do you want?
[?] config
     info ... Fetching https://github.com/h5bp/server-configs/archive/master.tar.gz ...
     info This might take a few moments
...............
✔ Done in 1.99s.
✔ Done in /Users/jeroen/.nvm/v0.10.11/lib/node_modules/generator-server-configs/app/templates


path.js:360
        throw new TypeError('Arguments to path.join must be strings');
        ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at directory (/Users/jeroen/.nvm/v0.10.11/lib/node_modules/yo/node_modules/yeoman-generator/lib/actions/actions.js:219:19)
    at null.<anonymous> (/Users/jeroen/.nvm/v0.10.11/lib/node_modules/generator-server-configs/app/index.js:21:9)
    at Extract.<anonymous> (/Users/jeroen/.nvm/v0.10.11/lib/node_modules/yo/node_modules/yeoman-generator/lib/actions/fetch.js:68:7)
    at Extract.EventEmitter.emit (events.js:117:20)
    at DirWriter.<anonymous> (/Users/jeroen/.nvm/v0.10.11/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/tar/lib/extract.js:67:8)
    at DirWriter.EventEmitter.emit (events.js:117:20)
    at end (/Users/jeroen/.nvm/v0.10.11/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/tar/node_modules/fstream/lib/writer.js:323:12)

Sorry I can't be of more help..

Hey,
I tried h5bp generator yesterday and I could not answer the "Would you like docs included?" question. I think this is an issue in yeoman, because I have problems with answering prompts at other places too (eg. when yeoman asks me if I want to replace existing file).

$ yo h5bp
[?] Would you like docs included? (y/N) N
error:   Invalid input
[?] Would you like docs included? (y/N) n
error:   Invalid input
[?] Would you like docs included? (y/N) 
error:   Invalid input
[?] Would you like docs included? (y/N) 
error:   Invalid input

Same here (generator-h5bp not accepting input on first prompt).
Consecutive prompts about eg overwriting existing .gitattributes do work without a problem.

I have updated yeoman to 1.0.0-beta7 right now and prompts are working for me.

Works for me too.