-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reinstall-packages doesn't work with non-npm modules #341
Comments
Indeed that's true. In fact, as of v0.17.2, despite its name, the
This fails in at least 2 scenarios:
Fixing (a) requires inspecting each package's Fixing (b) is simpler: Each global package directory must be tested for whether it is a symlink and, if so, that symlink can simply be copied as is to the new version. The following commands - based on the current # Get space-separated list of *package names* of all REGULAR global packages.
INSTALLS_NPM=$(npm ls -g --parseable --depth 0 |
while read -r f; do [ -L "$f" ] || echo "$f"; done |
xargs basename | xargs)
# Get space-separated list of *full folder paths* of all SYMLINKED-to-local-projects global packages.
INSTALLS_SYMLINKS=$(npm ls -g --parseable --depth 0 |
while read -r f; do [ -L "$f" ] && echo "$f"; done |
xargs) Generally I wonder whether |
@mklement0 I'd actually prefer That's a bunch of work but I'd love to accept some PRs to fix it :-) |
@ljharb I see, but wouldn't changing the existing behavior be a concern? If we just copy and run |
Not at all; that's what semantic version numbers are for. I'd probably rename |
…ackages-from` install option to `--reinstall-packages-from` For #341. `nvm copy-packages` and install option `--copy-packages-from` will continue to be supported for for at least a full minor release version.
The |
Cool, thanks. |
#693 solves this for linked packages. |
One possible approach is advice from @othiym23: "the _from and _resolved fields in the installed package.json will generally give you enough clues to figure out how the package was cached." however, he warns "that's not always user-friendly information, though. you have to have a fairly good grasp of how the caching algorithm works to interpret what those fields are telling you" so we'd need to tread very carefully. |
I post this in case there are other like me who are struggling with this issue and have many linked packages. The find command will echo rm commands for every system linked package. # Switch back to the old version
nvm use 0.12.7
# Unlink all linked modules
find $NVM_BIN/../lib/node_modules -maxdepth 1 -type l -exec echo rm {} \;
# Run the installer again
nvm install 4.1.0 --reinstall-packages-from=0.12.7 |
It's not working on v0.26.1. I thought that was the latest version? |
@moander Would you mind opening up a new github issue? Removing symlinks is a pretty brutal workaround for a likely trivial bug, and I'd rather fix the bug than encourage people to delete their linked modules. |
@ljharb I know this is old, but I think I was installing a local package to the global packages on my machine (called kapsel): $ cd /Users/me/SAP/MobileSDK3/KapselSDK/cli
$ npm install -g
...
$ nvm install 5.4.1 --reinstall-packages-from=9.6.1
...
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/kapsel Installing this local package globally is required by SAP for the HAT. They don't offer this in an online package, but instead you install it with their setup wizard and link it, globally. This is the package.json of the local package: {
"name": "kapsel",
"description": "A helper for creating Kapsel applications.",
"version": "3.15.0",
"homepage": "",
"author": {
"name": "SAP",
"email": ""
},
"repository": {
"type": "git",
"url": ""
},
"licenses": [
{
"type": "",
"url": ""
}
],
"main": "lib/kapsel_commands",
"engines": {
"node": ">=0.9.9"
},
"scripts": {
"test": "grunt nodeunit"
},
"dependencies" :
{
"archiver" : "~1.1.0",
"progress" : "~1.1.8",
"request": "~2.74.0",
"q" : "~1.4.1"
},
"keywords": [],
"preferGlobal": "true",
"bin": {
"kapsel" : "bin/kapsel.js"
}
} |
I installed a module
jakl/rbwhat
. When copying packages, I got this error:It looks like the
copy-packages
code might be assuming everything's from npm. This should be smarter and actually check each package.json - for one, if there's no install scripts, the module can just be copied directly to the new location. In addition, it should ideally be able to figure out from where the module was installed.The text was updated successfully, but these errors were encountered: