哟不知道已安装的发电机

  发布于 2023-02-07 10:54

我刚安装了Yeoman和一些发电机.但是,由于该/usr/lib文件夹受到保护,我选择更改NPM安装其包的位置的前缀.

现在,一切都安装在~/.node.我也改变了我的意见$PATH并补充说~/.node/bin.但是,当我执行时yo ,我得到以下内容:

Error node 

You don't seem to have a generator with the name node installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 0 registered generators run yo with the `--help` option.

正如你在这里看到的,它告诉我有0个注册的生成器,但我正确安装它们(并且它完成没有错误).我能够找到已安装的生成器,例如~/.node/lib/node_modules/generator-node存在,当我执行以下命令时:

npm list -g

我可以找到我安装的生成器(所以我认为它不是npm的问题).

所以我认为Yeoman(或更确切地说是Yo)并不知道自定义文件夹中安装的生成器,但我没有找到任何方法来配置它.

1 个回答
  • 除了将其添加到路径之外,还应设置NODE_PATH环境变量.该自耕农/发电机的代码将在那里寻找第一:

    // We tried using NPM to get the global modules path, but it haven't work out
    // because of bugs in the parseable implementation of `ls` command and mostly
    // performance issues. So, we go with our best bet for now.
    if (process.env.NODE_PATH) {
      _.compact(process.env.NODE_PATH.split(/[;:]/g)).forEach(this.appendPath, this);
      return;
    }
    

    2023-02-07 10:56 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有