代码之家  ›  专栏  ›  技术社区  ›  Jeffpowrs

Lerna Add不会添加内部依赖项

  •  0
  • Jeffpowrs  · 技术社区  · 7 年前

    我正在使用Lerna管理一个React组件库。我的一些组件既有来自NPM注册表的外部依赖项,也有来自存储库中的内部依赖项、兄弟包。

    Directory structure

    我正在尝试使用 lerna add 命令。具体来说,我想添加实用程序,排版,链接,到hrwrapper。

    添加我运行的实用程序 :

    lerna add Utils --scope=HRWrapper
    

    收到这个错误 :

    lerna notice cli v3.2.1
    lerna info versioning independent
    lerna WARN No packages found where Utils can be added.
    

    要安装我运行的排版 :

    lerna add Typography --scope=HRWrapper
    

    收到这个错误 :

    lerna notice cli v3.2.1
    lerna info versioning independent
    lerna ERR! Error: 404 Not Found - GET https://registry.npmjs.org/Typography - Not found
    lerna ERR!     at res.buffer.catch.then.body (/Users/powje6f/sites/vz-react/node_modules/npm-registry-fetch/check-response.js:104:15)
    lerna ERR! lerna 404 Not Found - GET https://registry.npmjs.org/Typography - Not found
    

    我不知道第一个错误在安装utils时意味着什么。但是,出于某种原因,当我尝试添加排版时,它正在NPM注册表中搜索它。

    这是我的Lerna.json :

    {
      "lerna": "2.10.0",
      "packages": ["packages/**/*"],
      "version": "independent"
    }
    

    我做错什么了?

    1 回复  |  直到 6 年前
        1
  •  0
  •   Zhansingsong    6 年前

    我也遇到过类似的麻烦。您可以尝试以下操作:

    lerna add module-1 packages/prefix-*       Adds the module-1 package to the packages in the 'prefix-' prefixed folders
    
    // Utils
    lerna add Utils packages/HRWrapper
    
    // Typography
    lerna add Typography packages/HRWrapper
    

    这条路对我很有效。

    lerna add module-1 --scope=module-2 
    

    我想不正常工作的原因是:

    只有 module-1 已经在NPM上注册,它是可用的。

    推荐文章