Comments (9)
@cdoublev The default behavior frpm npm 9 is to install linked dependencies instead of crating symlinks. If you need file dependencies to be links you need, then use --install-links=false.
from cli.
I want files and dependencies to be installed. I find this more convenient than stashing unstaged files and checking out the desired ref.
Thanks for the tip!
from cli.
@cdoublev As i mentioned you could use --install-links=false for files.
from cli.
npm i ../repo
creates a symlink node_modules/repo -> ../repo
. Assuming repo
has a dependency, it is not installed in node_modules
.
npm i --install-links ../repo
creates node_modules/repo
with all files from ../repo
. Assuming repo
has a dependency, it is also installed in node_modules
.
But I need files and dependencies from ../repo#<commit-or-tag>
to be installed in node_modules
, not the current files in ../repo
.
Sorry if I misunderstand you.
from cli.
Thanks for the clarification, based on your requirement you can install the contents and dependencies from a specific commit or tag in your local repo and you can use the following command
npm install git+file:///path/to/repo#commit-or-tag
This will clone the repo at the specified commit or tag and install the dependencies as per the package.json for that commit.
from cli.
Ah, it works with git+file:///absolute-path
, thansk!
This SO answer suggests that git ls-remote <relative-path>
works inexpectedly, and that git -C <relative-path> rev-parser
should be used instead. Not sure what happens under the hood of npm
when using git+file:///absolute-path
vs. git+file:relative-path
.
Might be worth adding a note about this, isn't it?
from cli.
Actually, it does not work: npm
creates a symlink node_modules/repo -> ../^git+file:/absolute-path/repo
.
Never mind, I made a typo in the dependency version.
from cli.
Thanks for confirming, glad the provided solution worked for you.
from cli.
Ah, too bad, leaving this bug unfixed and this requirement (git+file
only accepts absolute paths - starting with /
- preceded by git+file://
) undocumented seem to favor a poor user experience.
from cli.
Related Issues (20)
- [DOCS] npm doesn't install the latest tagged version if engines are invalid HOT 6
- [BUG] npm dist-tag rm only removes the last recently deleted tag HOT 9
- [BUG] `npm publish --provenance` The default value `public` isn't used HOT 5
- [Enchancement] Check files that import the package before uninstalling HOT 1
- [BUG] npm docs with no pkgname arg returns undefined HOT 2
- [BUG] No README.md on npmjs ? HOT 4
- [BUG] Problem / error links are incorrect when path contains prefix before space HOT 3
- [BUG] npm version -ws never update dependencies in package.json HOT 3
- npm ERR! Exit handler never called! npm ERR! This is an error with npm itself. HOT 1
- Licence missing for npm update
- [BUG] <title> HOT 1
- [BUG] npm install --save three: No matching version found for three@^0.777.1. HOT 3
- (npm error Exit handler never called!:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError HOT 1
- [BUG] Unable to upgrade two packages with a dep and peer dep on the same package that is also bumped HOT 5
- npm i changing package-lock.json HOT 4
- [BUG] Windows npm install --prefix errors and looks for the package.json in the cwd HOT 5
- [BUG] <prepare script called with CMD on windows> HOT 1
- Feature request: Add config option to prevent accidental installation of packages in directories without package.json HOT 2
- [BUG] npm publish <package-spec> in a workspace is not taking package-spec into account HOT 1
- [BUG] package binaries with .hidden folders don't install globally HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.