2017-05-28 75 views
0

我想創建一個自耕農發生器(它已經published on npm),但我已經打了幾個障礙。約曼找不到發電機

我不知道這是否與我的節點設置或代碼。我troubleshooted與一對夫婦的類似問題的幫助:

我可以成功運行其他發電機,所以我相當肯定,在這一點上,這是一個代碼問題。

發電機安裝旁邊yo

$ nvm use 7 
Now using node v7.7.4 (npm v4.1.2) 
$ npm install -g generator-spike yo 
$ ls /Users/developer/.nvm/versions/node/v7.7.4/lib/node_modules 
generator-generator generator-spike  http-server  npm   yarn   yo 
$ ls /Users/developer/.nvm/versions/node/v7.7.4/lib/node_modules/generator-spike 
README.md actions  app  base.js  node_modules package.json 

喲安裝正確。

$ yo doctor 

Yeoman Doctor 
Running sanity checks on your system 

✔ Global configuration file is valid 
✔ NODE_PATH matches the npm root 
✔ Node.js version 
✔ No .bowerrc file in home directory 
✔ No .yo-rc.json file in home directory 
✔ npm version 

Everything looks all right! 

Yeoman發現發電機。

$ yo --generators 
Available Generators: 

    generator 
    subgenerator 
    spike 
    actions 

但是喲不能運行發電機:

$ yo spike:actions -f yada 
Error spike:actions -f yada 

You don’t seem to have a generator with the name 「spike:actions」 installed. 
But help is on the way: 

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/. 
Install them with npm install generator-spike:actions. 

To see all your installed generators run yo without any arguments. Adding the --help option will also show subgenerators. 

If yo cannot find the generator, run yo doctor to troubleshoot your system. 

回答

1

約曼不支持ES6 export default。使用module.exports =

從'path'導入路徑;從'../base'導入基地; ;

module.exports = class Actions extends Base { 
    // ... 
}