Skip to content
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-from fails: "Could not install from "" as it does not contain a package.json file" #1744

Closed
steelstring94 opened this issue Feb 23, 2018 · 22 comments
Labels
bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions. pull request wanted This is a great way to contribute! Help us out :-D

Comments

@steelstring94
Copy link

steelstring94 commented Feb 23, 2018

  • Operating system and version: Fedora KDE 27

  • nvm debug output:

nvm --version: v0.33.8
$SHELL: /bin/bash
$HOME: /home/[my name]
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 4.14.18-300.fc27.x86_64 #1 SMP Thu Feb 8 01:35:31 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux'
OS version: 
curl: /usr/bin/curl, curl 7.55.1 (x86_64-redhat-linux-gnu) libcurl/7.55.1 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.18.0 (+libidn2/2.0.3) libssh2/1.8.0 nghttp2/1.25.0
wget: /usr/bin/wget, GNU Wget 1.19.4 built on linux-gnu.
git: /usr/bin/git, git version 2.14.3
grep: alias grep='grep --color=auto'
        /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.1
awk: /usr/bin/awk, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 3.1.5, GNU MP 6.1.2)
sed: /usr/bin/sed, sed (GNU sed) 4.4
cut: /usr/bin/cut, cut (GNU coreutils) 8.27
basename: /usr/bin/basename, basename (GNU coreutils) 8.27
rm: /usr/bin/rm, rm (GNU coreutils) 8.27
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.27
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.6.0
nvm current: v9.6.1
which node: $NVM_DIR/versions/node/v9.6.1/bin/node
which iojs: which: no iojs in (/opt/OpenPrinting-Gutenprint/sbin:/opt/OpenPrinting-Gutenprint/bin:$NVM_DIR/versions/node/v9.6.1/bin:/usr/lib64/qt-3.3/bin:/opt/OpenPrinting-Gutenprint/sbin:/opt/OpenPrinting-Gutenprint/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:$HOME/.local/bin:$HOME/bin)
which npm: $NVM_DIR/versions/node/v9.6.1/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v9.6.1
npm root -g: $NVM_DIR/versions/node/v9.6.1/lib/node_modules
  • nvm ls output:
         v9.6.0
->       v9.6.1
default -> v9.6.0
node -> stable (-> v9.6.1) (default)
stable -> 9.6 (-> v9.6.1) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.8.7 (-> N/A)
lts/boron -> v6.13.0 (-> N/A)
lts/carbon -> v8.9.4 (-> N/A)
  • How did you install nvm? (e.g. install script in readme, homebrew): Install script I believe. It's been a while.

  • What steps did you perform?

  1. nvm ls-remote
  2. See there is a new version, e.g. v9.6.1
  3. nvm install v9.6.1 --reinstall-packages-from=v9.6.0
  • What happened?
Downloading and installing node v9.6.1...
Downloading https://nodejs.org/dist/v9.6.1/node-v9.6.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v9.6.1 (npm v5.6.0)
Reinstalling global packages from v9.6.0...
npm ERR! code ENOLOCAL
npm ERR! Could not install from "" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/[my name]/.npm/_logs/2018-02-23T15_26_22_862Z-debug.log
Linking global packages from v9.6.0...
  • What did you expect to happen?
    Just install any previous packages like normal. This used to work fine on Ubuntu but I am on Fedora now, not sure if that makes a difference.

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
    No.

@PeterDaveHello
Copy link
Collaborator

PeterDaveHello commented Feb 23, 2018

@steelstring94 can you print the content of /home/[my name]/.npm/_logs/2018-02-23T15_26_22_862Z-debug.log?

@PeterDaveHello
Copy link
Collaborator

I tested with the latest Fedora 27 Docker image but can't reproduce this problem.

@steelstring94
Copy link
Author

steelstring94 commented Feb 23, 2018

@PeterDaveHello Can you do me a favor and censor my name out of your post? I tried to censor it in my OP but I missed one.

0 info it worked if it ends with ok
1 verbose cli [ '/home/[my name]/.nvm/versions/node/v9.6.1/bin/node',
1 verbose cli   '/home/[my name]/.nvm/versions/node/v9.6.1/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   '--quiet' ]
2 info using npm@5.6.0
3 info using node@v9.6.1
4 verbose npm-session 7882bbe438c61849
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for file: Could not install from "" as it does not contain a package.json file.
8 verbose stack Error: ENOENT: no such file or directory, open '/home/[my name]/package.json'
9 verbose cwd /home/[my name]
10 verbose Linux 4.14.18-300.fc27.x86_64
11 verbose argv "/home/[my name]/.nvm/versions/node/v9.6.1/bin/node" "/home/[my name]/.nvm/versions/node/v9.6.1/bin/npm" "install" "-g" "--quiet"
12 verbose node v9.6.1
13 verbose npm  v5.6.0
14 error code ENOLOCAL
15 error Could not install from "" as it does not contain a package.json file.
16 verbose exit [ 1, true ]

@PeterDaveHello
Copy link
Collaborator

PeterDaveHello commented Feb 23, 2018

@steelstring94 what about the output of nvm_npm_global_modules v9.6.0?

@PeterDaveHello
Copy link
Collaborator

Just to confirm, is this output the raw or the modified? I wonder about the "" here:
npm ERR! Could not install from "" as it does not contain a package.json file.

@steelstring94
Copy link
Author

nvm_npm_global_modules v9.6.0 output is ////. It is the exact same, by the way, if I use v9.6.1 as the argument.

And yes, that output is raw. It really does have two empty double quotes.

@PeterDaveHello
Copy link
Collaborator

Looks like nvm didn't fetch the installed packages properly, what about npm list -g --depth=0?

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Feb 24, 2018
@steelstring94
Copy link
Author

steelstring94 commented Feb 27, 2018

/home/[my name]/.nvm/versions/node/v9.6.1/lib
└── npm@5.7.1

@ljharb
Copy link
Member

ljharb commented Feb 27, 2018

That seems correct to me; that means there's no non-npm global modules installed.

It seems like the logic here doesn't actually check for "no installs" - the fix is likely as simple as wrapping https://github.com/creationix/nvm/blob/master/nvm.sh#L3341-L3342 in if [ -n "${INSTALLS}" ]; then and https://github.com/creationix/nvm/blob/master/nvm.sh#L3344-L3345 in if [ -n ${LINKS}" ]; then, and outputting appropriate messages else that nothing was found.

@ljharb ljharb added installing node Issues with installing node/io.js versions. bugs Oh no, something's broken :-( pull request wanted This is a great way to contribute! Help us out :-D and removed needs followup We need some info or action from whoever filed this issue/PR. labels Feb 27, 2018
@PeterDaveHello
Copy link
Collaborator

Looks like you're using a manually installed very new npm version?

@PeterDaveHello
Copy link
Collaborator

I assume @steelstring94 has something to be installed so you'd like to use that parameter to install the old packages?

PeterDaveHello added a commit to PeterDaveHello/nvm that referenced this issue Feb 27, 2018
@steelstring94
Copy link
Author

@PeterDaveHello "Looks like you're using a manually installed very new npm version?" - not as far as I'm aware. I'm pretty sure this is just what came with NVM.

@ljharb
Copy link
Member

ljharb commented Feb 28, 2018

@steelstring94 it's not; 5.6.0 is the "latest" npm. you may have run nvm install-latest-npm or npm upgrade -g tho?

@steelstring94
Copy link
Author

@ljharb I have used npm update -g

@PeterDaveHello
Copy link
Collaborator

So besides npm update -g, did you install any other packages?

@steelstring94
Copy link
Author

@PeterDaveHello I don't believe so. It's difficult for me to say 100% as I didn't expect this to happen so I wasn't particularly keeping track of whether I installed anything, but I switched to a new distro not long ago and I don't think I've used any NPM global packages on here yet.

@PeterDaveHello
Copy link
Collaborator

because if you didn't install anything, you don't need to use --reinstall-packages-from, though I agree that nvm should notice that nothing is installed and prevent to call npm in this case, to avoid this problem.

@ljharb
Copy link
Member

ljharb commented Feb 28, 2018

@steelstring94 fwiw, don’t use npm update -g; use nvm install-latest-npm or `npm install -g npmrc; that way you won’t get unstable versions.

@steelstring94
Copy link
Author

@ljharb I thought npm update -g was to install the latest versions of global packages you have installed with npm? Am I wrong?

@ljharb
Copy link
Member

ljharb commented Feb 28, 2018

Yes, but that will also update npm; it’s best to update your global packages (of which there should be few) manually.

ljharb pushed a commit to PeterDaveHello/nvm that referenced this issue Mar 1, 2018
@imibrar
Copy link

imibrar commented Jan 11, 2019

I was facing the same issue in windows 10, when my user folder has space in folder name
"C:\Users\Ibrar Hussain", I rename it to "C:\Users\IbrarHussain" and now its working fine.
you can Google it to rename the user folder. https://www.google.com/search?q=how+to+rename+user+folder+in+windows+10

@ljharb
Copy link
Member

ljharb commented Jan 11, 2019

@imibrar that seems like it's worth a separate bug. Can you file one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions. pull request wanted This is a great way to contribute! Help us out :-D
Projects
None yet
Development

No branches or pull requests

4 participants