yeoman / generator-generator

Generate a Yeoman generator
1.22k stars 237 forks source link

Generator should generate generator that generates valid projects #217

Closed flatiron32 closed 6 years ago

flatiron32 commented 6 years ago

I expect the following to work correctly

yo generator
# Use default entries
cd generator-development
npm test
npm link
cd /tmp
yo development
gvlekke commented 6 years ago

yeah when i do npm test i get a lot of errors. #216 is related

Also when i do npm link and then yo development

I get this error:

rror: Cannot find module '/Users/gvlekke/Desktop/bin/npm-cli.js'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

Do you also experience this @flatiron32 ?

SBoudrias commented 6 years ago

@flatiron32 how is it not working? Error message? Wrong behavior? Can you describe the issues you're encountering?

mischah commented 6 years ago

Linting errors are fixed in v4.0.1.

@flatiron32 Please let us know if your problems aren’t gone after updating generator-generator.

@gvlekke Your error regarding npm-cli.js seems to be related to wrong system path variables. Google will help you.

gvlekke commented 6 years ago

@mischah thx, already tried it but was hard to find a solution for that.

mischah commented 6 years ago

@gvlekke This one doesn’t fix your problems? https://stackoverflow.com/questions/24721903/npm-cli-js-not-found-when-running-npm

flatiron32 commented 6 years ago

I updated to 4.0.2. It is better than it was before however following the steps from the initial report I get

12:42 $ yo development                                                                                                                                                                                                                                                          

     _-----_     ╭──────────────────────────╮                                                                                                                                                                                                                                   
    |       |    │ Welcome to the priceless │                                                                                                                                                                                                                                   
    |--(o)--|    │   generator-development  │                                                                                                                                                                                                                                   
   `---------´   │        generator!        │                                                                                                                                                                                                                                   
    ( _´U`_ )    ╰──────────────────────────╯                                                                                                                                                                                                                                   
    /___A___\   /                                                                                                                                                                                                                                                               
     |  ~  |                                                                                                                                                                                                                                                                    
   __'.___.'__                                                                                                                                                                                                                                                                  
 ´   `  |° ´ Y `                                                                                                                                                                                                                                                                

? Would you like to enable this option? Yes                                                                                                                                                                                                                                     
   create dummyfile.txt                                                                                                                                                                                                                                                         

I'm all done. Running npm install && bower install for you to install the required dependencies. If this fails, try running the command yourself.                                                                                                                               

npm WARN saveError ENOENT: no such file or directory, open '/private/tmp/package.json'                                                                                                                                                                                          
npm notice created a lockfile as package-lock.json. You should commit this file.                                                                                                                                                                                                
npm WARN enoent ENOENT: no such file or directory, open '/private/tmp/package.json'                                                                                                                                                                                             
npm WARN tmp No description                                                                                                                                                                                                                                                     
npm WARN tmp No repository field.                                                                                                                                                                                                                                               
npm WARN tmp No README data                                                                                                                                                                                                                                                     
npm WARN tmp No license field.                                                                                                                                                                                                                                                  

up to date in 0.052s                                                                                                                                                                                                                                                            
Could not finish installation.                                                                                                                                                                                                                                                  
Please install bower with npm install -g bower and try again.                                                                                                                                                                                                                   
Error: spawn bower ENOENT                                                                                                                                                                                                                                                       
    at _errnoException (util.js:1003:13)                                                                                                                                                                                                                                        
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)                                                                                                                                                                                                   
    at onErrorNT (internal/child_process.js:389:16)                                                                                                                                                                                                                             
    at process._tickCallback (internal/process/next_tick.js:152:19)                                                                                                                                                                                                             

If I install bower manually I then get a slightly better but not great result

12:43 $ yo development                                                                                                                                                                                                                                                          

     _-----_     ╭──────────────────────────╮                                                                                                                                                                                                                                   
    |       |    │ Welcome to the priceless │                                                                                                                                                                                                                                   
    |--(o)--|    │   generator-development  │                                                                                                                                                                                                                                   
   `---------´   │        generator!        │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? Would you like to enable this option? Yes
identical dummyfile.txt

I'm all done. Running npm install && bower install for you to install the required dependencies. If this fails, try running the command yourself.

npm WARN saveError ENOENT: no such file or directory, open '/private/tmp/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/private/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.

up to date in 0.053s
bower                           ENOENT No bower.json present

If you want the generator to demonstrate generating generators that use npm and bower I suggest creating a directory with a package.json and bower.json in it.

mischah commented 6 years ago

Thanks for the feedback.

  1. You need to have bower installed globally like you did.

  2. The generated generator calls this.installDependencies(); without any parameters.

The default behavior is to install dependencies via Bower and npm. It’s up to you to disable Bower in your generator via:

this.installDependencies({
  npm: true,
  bower: false,
  yarn: false
});

See http://yeoman.io/authoring/dependencies.html for additional information about how to handle dependecies.


@SBoudrias I guess it’s about time to disable Bower by default.

gvlekke commented 6 years ago

I also think its indeed time to disable bower by default.

@mischah im using osx and nvm.

This is my path:

echo $path
/Users/gvlekke/.rbenv/shims /Users/gvlekke/.nvm/versions/node/v8.4.0/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Applications/Wireshark.app/Contents/MacOS /Users/gvlekke/Library/Android/sdk/platform-tools/

the shim of nvm is point to the bin folder, in the link you post they also saying that it needs to redirect to the node folder and not the bin folder. But I think that is not how nvm works... Im wonder how i can fix this and still can switch between node versions.

mischah commented 6 years ago

@gvlekke Mhm. I’m using nvm on Mac OS as well and never encountered such a problem. Installed it that way.

The $path looks okay. Sorry, I’m clueless for now.

I‘d recommend posting your problem in our Gitter channel. Maybe someone else has an idea.

SBoudrias commented 6 years ago

I also think its indeed time to disable bower by default.

Just use this.npmInstall(), I think that's what most people do nowaday.