At work, we have our own npm packages that we manage and maintain. As part of the dev process its crucial to test out the package in the context of...
For further actions, you may consider blocking this person and/or reporting abuse
Came across a similar linking issue and I wasn't able to fix it via unlinking, I had to resort to deleting the package-lock.json :(
Also, in case you weren't aware another way to npm link is to be in the directory of the project and then
npm link ../../package-directory
. I like it for saving me a stepThanks Erin! This is exactly the situation I found myself in. Appreciate the write up!
Out of curiosity though -- why is the
--no-save
flag important?Looks like
unlink
is an alias foruninstall
, so the--no-save
means uninstall, but don't remove fromnode_modules
?Yep! If you don't include
--no-save
you'll end up removing that package from your package.json file. Of course, if you don't want to include the unlinked package in your package.json file, you can exclude the--no-save
Found this helpful - medium.com/dailyjs/how-to-use-npm-...
Also... let's say you do goof and get the
ENOENT: no such file or directory, access '/...
error... then what?What I've had to do is go back to whatever state has the files/folders that npm is looking for. So let's say you have a package that is on one branch and not on another, you'd have to go back to your other branch and run
npm link
again for that package before runningnpm unlink my-package-name
in your main projectYou may also go to the folder where the symbolic link library is installed and deleted the folder.
Hi Erin! Thanks for explaining this topic more.
What is
npm install -g i .
doing? I understand that it is installing the package globally with the-g
and the.
is taking all the files from the current directory. Specifically, what isi
? Is this an alias? And why do you add it here?Is the
i
referring to the NPM at this link npmjs.com/package/iIs there a reason to install
i
along with the folder where package.json is located?Whenever I run
npm unlink
in my package folder, it removes a lot of global node modules...I am not able to understand what exactly is happeningAwesome post! I also dislike the fact that the
--no-save
option is needed. I rannpm unlink
without it and now I can't use the original package anymore... 😢if I delete link package how to delete symbolic link?
Hey Erin, i found this really helpfull. But i broke the pipeline by sending the push with the linked custom package. So i hope no one did that