简体   繁体   English

安装在本地 npm package 没有符号链接

[英]installed local npm package is not symlinked

I have installed a local npm package via:我通过以下方式安装了本地 npm package:

npm i ./my_modules/mypackage

It shows up in my dependencies as:它在我的依赖项中显示为:

  "dependencies": {
    "mypackage": "file:my_modules/mypackage"
  }

when I look at the node_modules folder, it shows up in there as well, but it is not symlinked当我查看node_modules文件夹时,它也显示在那里,但它没有符号链接

there is no arrow icon in the explorer indicating it is symlinked资源管理器中没有箭头图标表示它是符号链接的

which means I have to rebuild every single time I want to see changes inside the local package这意味着每次我想查看本地 package 中的更改时,我都必须重建

this only just started happening today, I'm not sure why it's not symlinking all of the sudden这只是今天才开始发生,我不确定为什么它没有突然符号链接

how do I resolve this issue so that it symlinks properly?我该如何解决这个问题以使其正确链接? it used to do this automatically and now it isn't.它曾经自动执行此操作,现在不是。 I've even tried re-installing everything on my dev machine and it is still doing this behaviour.我什至尝试在我的开发机器上重新安装所有内容,但它仍在执行此操作。

normally when I install a local npm package it will symlink it properly, automatically通常,当我安装本地 npm package 时,它会自动正确地进行符号链接

now, for whatever reason, it is not symlinking现在,无论出于何种原因,它都不是符号链接

EDIT编辑

I've even tried using npm link我什至尝试过使用npm link

cd my_modules/mypackage
npm link
cd ../../
npm link mypackage
npm I ./my_modules/mypackage

still doesn't symlink.仍然没有符号链接。

Some conflicts could happen.可能会发生一些冲突。 To resolve that go to the root of your npm package folder and call npm unlink<package_name> then in your test folder remove node_modules and even you can delete your package.json.要将 go 解析到您的 npm package 文件夹的根目录并调用npm unlink<package_name>然后在您的测试文件夹中删除 node_modules,甚至您可以删除您的 package.json。 After you reset that you can again go to the root of your npm package and call the npm link then install your local npm package in the test folder and test it out.重置后,您可以再次 go 到 npm package 的根目录并调用npm link ,然后在测试文件夹中安装本地 npm package 并进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM