【问题标题】:Can't npm link local dependency无法 npm 链接本地依赖项
【发布时间】:2021-07-11 13:34:32
【问题描述】:

我正在尝试使用通常的方法将本地项目 testabc123 链接到 myproject

cd testabc123
npm link
cd ../myproject
npm link testabc123

但是我收到了错误消息:

npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/testabc123 - Not found
npm ERR! 404
npm ERR! 404  'testabc123@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)

有什么想法吗?我链接本地项目的方法似乎很常见,大多数人都能成功。

【问题讨论】:

  • 为什么要链接?测试模块?
  • testabc123 是一个依赖项。我想编辑testabc123 中的代码并将其反映在myproject(它使用该依赖项)中。
  • 你还没有将你的模块发布到 npm,并且你正在尝试从那里获取?这就是问题所在。 registry.npmjs.org/testabc123 去搜索 npm 注册表。
  • 试试npm link ../testabc123
  • @ManishSoni 好的,但是这个网站上有很多答案告诉我完全按照我上面所做的那样做,而且这些答案有很多赞成票。我认为还有其他事情发生。

标签: javascript npm npm-link


【解决方案1】:

文件夹结构

some-folder
--testabc123
--myproject

转到 myproject 并执行 npm link ../testabc123 您可能需要管理员权限才能执行此操作。

【讨论】:

    猜你喜欢
    • 2021-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-17
    • 2020-03-14
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    相关资源
    最近更新 更多