-
Notifications
You must be signed in to change notification settings - Fork 3k
Update of local dependencies does not work #7426
Comments
I think you may want to use When you depend on a directory via With In general this is recommended for development, not production though. Can you tell me more about your situation and what you're trying to accomplish? See https://docs.npmjs.com/cli/link |
Well, let me clarify our situation: So we tried to store each sub-module in its own repository and So we aggregated them into a single repository again and used local dependencies once they were introduced. That resolved our problems except the issue during deployment described above (currently we work around that by deleting We already know about What would be the right approach in this case? |
What about setting up your NODE_PATH in production so that it searches all of your submodule roots? http://nodejs.org/api/modules.html#modules_loading_from_the_global_folders Another option would be to write a wrapper around |
Using We already discussed writing a wrapper/replacement for |
This is getting well beyond my expertise unfortunately -- it is essentially a devops question now. One thing that might work for deployment would be to build the entire package tree once, offline, and pack it up with "npm pack" (possibly using bundledDependencies) Then you would have a single tgz representing your new version and could deploy it across however many instances you are running. If you have to support upgrading in-place, then "rm -rf node_modules; npm install" is the best way to be sure... How long is "very time-consuming"? And of course npm@3 should help with this, because its approach is to build the complete desired dependency graph, calculate the difference between desired and current, and then apply the changes needed to make the transition. Should be cheaper than what you see now. |
Yes, I suppose uploading a tgz and extracting it might save some time in comparison to Is there a link where the new dependency management of npm@3 is described? It sounds interesting but I reckon that it is based on the module versions and not on the content. So if the version sub-module version is not incremented the content is not synchronized. Is that right? I was hoping for something like
Nevertheless: Thank you very much for your support and your detailed explanations! |
Here's the blog post that lays out the roadmap for
I think that's not quite right; it's even worse than that. If you are directly installing from git submodules then You may be able to mitigate this a bit by running a private Also you might want to check out npm's paid product, |
As far as I understand, at least I looked at the feature list of I'm still wondering what the preferred npm-way for updating a previously populated package structure is (instead of |
I found a longer discussion on #1558 with similar use cases and the local paths feature seems to be the "official" fix for those scenarios. If There is also the suggestion of using |
wrt npm-enterprise, as I said, I don't know much about the product. I was thinking it may be faster/ more efficient if your sub-dependencies were already packaged as modules. An
I don't believe there is a preferred way in The |
You may want to look at #6251 (unfulfilled feature request) On Wed, Feb 25, 2015 at 10:04 AM, Andreas Klöber notifications@github.com
|
I believe this scenario is one of many that will be handled much better by |
So with However, this does seem like a legitimate bug in |
Funny, mind blowing experience I had that made me realise how easy it is to fix this issue: I created a proof of concept project. This is why: So, because the request succeeds, the package is successfully updated, the way it's intended, regardless of what's returned. I guess that the request should not be made if dependency is |
Actually, it's very easy to spot how
Also, because |
From the tests, I understand that private packages (ie. local packages that are not published on the repository) are just expected to be ignored. Why don't we just handle them? This would solve the whole "Better local require() paths" problem so easily! |
#7934 is ready and should make everybody happy. |
+1 Also here is what I don't understand. Why when you use the ala
doesnt it just look for the packages at that directory? Why does it require you to npm install and have npm install install them to the local I'm working on a box with several other people all working on the same project. And while I'm the only one working on the modules I don't want to stomp on the global ones when im developing and breaking them and hold others up so |
I'll give you a clue in the form of a question: what is 'it' in your question? Node (and its module loader) doesn't know anything about npm or the contents of As for why local dependencies aren't set up as symlinks in the first place, that's a question for #6251. Give |
@othiym23 Thanks that explanation makes a lot of since. And yeah I just found linklocal it seems to suit my needs pretty well. Just was really confusing at first because everything I had read up until your comment made it seem as if |
PR-URL: #1532 Notable Changes: * crypto: significantly reduced memory usage for TLS (Fedor Indutny & Сковорода Никита Андреевич) #1529 * net: socket.connect() now accepts a 'lookup' option for a custom DNS resolution mechanism, defaults to dns.lookup() (Evan Lucas) #1505 * npm: Upgrade npm to 2.9.0. See the v2.8.4 and v2.9.0 release notes for details. Notable items: - Add support for default author field to make npm init -y work without user-input (@othiym23) npm/npm/d8eee6cf9d - Include local modules in npm outdated and npm update (@ArnaudRinquin) npm/npm#7426 - The prefix used before the version number on npm version is now configurable via tag-version-prefix (@kkragenbrink) npm/npm#8014 * os: os.tmpdir() is now cross-platform consistent and will no longer returns a path with a trailling slash on any platform (Christian Tellnes) #747 * process: - process.nextTick() performance has been improved by between 2-42% across the benchmark suite, notable because this is heavily used across core (Brian White) #1548 - New process.geteuid(), process.seteuid(id), process.getegid() and process.setegid(id) methods allow you to get and set effective UID and GID of the process (Evan Lucas) #1536 * repl: - REPL history can be persisted across sessions if the NODE_REPL_HISTORY_FILE environment variable is set to a user accessible file, NODE_REPL_HISTORY_SIZE can set the maximum history size and defaults to 1000 (Chris Dickinson) #1513 - The REPL can be placed in to one of three modes using the NODE_REPL_MODE environment variable: sloppy, strict or magic (default); the new magic mode will automatically run "strict mode only" statements in strict mode (Chris Dickinson) #1513 * smalloc: the 'smalloc' module has been deprecated due to changes coming in V8 4.4 that will render it unusable * util: add Promise, Map and Set inspection support (Christopher Monsanto) #1471 * V8: upgrade to 4.2.77.18, see the ChangeLog for full details. Notable items: - Classes have moved out of staging; the class keyword is now usable in strict mode without flags - Object literal enhancements have moved out of staging; shorthand method and property syntax is now usable ({ method() { }, property }) - Rest parameters (function(...args) {}) are implemented in staging behind the --harmony-rest-parameters flag - Computed property names ({['foo'+'bar']:'bam'}) are implemented in staging behind the --harmony-computed-property-names flag - Unicode escapes ('\u{xxxx}') are implemented in staging behind the --harmony_unicode flag and the --harmony_unicode_regexps flag for use in regular expressions * Windows: - Random process termination on Windows fixed (Fedor Indutny) #1512 / #1563 - The delay-load hook introduced to fix issues with process naming (iojs.exe / node.exe) has been made opt-out for native add-ons. Native add-ons should include 'win_delay_load_hook': 'false' in their binding.gyp to disable this feature if they experience problems . (Bert Belder) #1433 * Governance: - Rod Vagg (@rvagg) was added to the Technical Committee (TC) - Jeremiah Senkpiel (@Fishrock123) was added to the Technical Committee (TC)
I came across this thread after having the same issue. My expectation is that a file: reference in the version field should work the same as any other type of dependency in the version field - i.e that an 'npm update' would pull the latest version within the given constraints (whatever packaging/unpacking is done internally). Just looking for consistency with http and git references. I understand that npm link would give me a 'live' version of my dependent module, but this might not be what I want, and AFAICT is not supported by package.json. |
+1 I, too, would love to see a working solution native to |
There another flaw in the first approach: if you want to have your package's root directory as a link target then you will end-up in infinite loop of Solution is to remove the symlink in "scripts": {
"preinstall": "rm -f $(pwd)/node_modules/app",
"postinstall": "mkdir -p $(pwd)/node_modules && ln -s $(pwd) $(pwd)/node_modules/app"
} * it's not adapted for Windows |
This is likely a separate issue so I can make a case if deemed so, but @kossnocorp's solution (which is very similar to what I use) fails on npm@3 when trying to shrinkwrap (doesn't on npm@2) because the symlink is an "extraneous dependency". Not sure how to work around that yet or if that is a bug. |
@wavded didn't tried, but I'm pretty sure that you can do such trick: "preshrinkwrap": "npm run prebuild",
"postshrinkwrap": "npm run postbuild", |
@kossnocorp seems like there isn't lifecycle hooks for shrinkwrap, at least i haven't had any luck so far |
I'm surprised that this does not work, and I'm really missing this feature. Here is the use case:
It should really be that easy. Here are some things I tried and why they fail:
I feel like |
I have the same problem when using local dependencies. I'm using |
I'm seing the same thing as @kentingxu. It's very convenient to list modules as local fs dependencies of a parent project and use
|
I have the same problem, my workaround for now is to just delete the package folder in node_modules then do |
This is still a bug in 3.8.2. |
I have the same issue. It is a bug. Local packages should be treated the same as any other. |
Same issue here. |
My solution is to namespace my modules so I only have to remove the namespaced modules instead of the whole "scripts": {
"preinstall": "rimraf node_modules/namespace-*"
} |
Is this still an issue? I'm having the sam problem with local packages. removing the |
I still have the issue that running |
Using |
Is the behaviour for e.g. github repos the same?
|
@xkr47 I did some cursory tests and it appears that |
We're closing this issue as it has gone thirty days without activity. In our experience if an issue has gone thirty days without any activity then it's unlikely to be addressed. In the case of bug reports, often the underlying issue will be addressed but finding related issues is quite difficult and often incomplete. If this was a bug report and it is still relevant then we encourage you to open it again as a new issue. If this was a feature request then you should feel free to open it again, or even better open a PR. For more information about our new issue aging policies and why we've instituted them please see our blog post. |
... aaaaaand reopened |
npm cache clean ( Optional step) |
@kimek While there are many workarounds, I believe the larger issue here is the API that is baked into |
I have some local dependencies on sub-modules in the same git repo like this:
With this I can do
require('sub-mod-0')
without having to use something likerequire('../../sub-mod-0')
Installation via
npm install
works fine and populatesnode_modules/sub-mod-0
andnode_modules/sub-mod-1
but updating them is not possible without manually deletingnode_modules/sub-mod-*
beforehand. Neithernpm install
nornpm update
nornpm update sub-module-*
have an effect even if the version of the sub-module is incremented.Environment:
npm v2.6.0
node v0.10.25
Ubuntu 14.04.1 LTS
The text was updated successfully, but these errors were encountered: