Why are my Yeoman generators installing in the wrong place?

前端 未结 4 1632
孤独总比滥情好
孤独总比滥情好 2020-12-08 10:02

I have a problem with Yeoman generators. They install just fine if I run \"npm install [generator-name] -g\". However when I try to run \"yo [generator-name] yeoman can\'t s

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 10:10

    Sounds like your npm may be out of whack. Check where things are installed: npm config get prefix Is that where you expected the packages to install? Is that where they are currently installed?

    To list whats in there:

    ls $(npm config get prefix)/lib/node_modules
    

    That will list out the globally installed npm packages.

    npm list -g
    

    Will list the currently installed things. Make sure yo and the generators are listed at the top level.

    To remove the yo stuff and start over:

    npm remove -g yo generator-* yeoman-generator
    npm install -g yo generator-angular
    

    That should fix things.

提交回复
热议问题