Firebase-admin-node: npm update firebase-admin fails with ENOENT: no such file or directory, rename

Created on 25 Oct 2017  路  12Comments  路  Source: firebase/firebase-admin-node

I think I have the same issue as posted here for NPM. However, I have not had this issue with any other packages, so I think the problem is firebase-admin version 5.4.3 (version 5.4.2 works fine), not NPM.

System info

Mac OS: 10.12.6
Node: 8.6.0
NPM: 5.5.1
firebase-admin: 5.4.2 -> 5.4.3
Installed NPM Packages:

@ google-cloud/[email protected]
@ types/[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

Install Error

Running npm update gives this error:

npm ERR! path /Users/Username/Sites/Sitename/functions/node_modules/firebase-admin/node_modules/grpc/node_modules/abbrev
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/abbrev' -> '/Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/.abbrev.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Username/.npm/_logs/2017-10-25T01_25_07_312Z-debug.log

And here's the relevant part of the log file:

8231 verbose unlock done using /Users/Username/.npm/_locks/staging-e6d3ce262201f329.lock for /Users/Username/Sites/Sitename/node_modules/.staging
8232 verbose stack Error: ENOENT: no such file or directory, rename '/Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/abbrev' -> '/Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/.abbrev.DELETE'
8233 verbose cwd /Users/Username/Sites/Sitename
8234 verbose Darwin 16.7.0
8235 verbose argv "/Users/Username/.nvm/versions/node/v8.6.0/bin/node" "/Users/Username/.nvm/versions/node/v8.6.0/bin/npm" "update"
8236 verbose node v8.6.0
8237 verbose npm  v5.5.1
8238 error path /Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/abbrev
8239 error code ENOENT
8240 error errno -2
8241 error syscall rename
8242 error enoent ENOENT: no such file or directory, rename '/Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/abbrev' -> '/Users/Username/Sites/Sitename/node_modules/firebase-admin/node_modules/grpc/node_modules/.abbrev.DELETE'
8243 error enoent This is related to npm not being able to find a file.
8244 verbose exit [ -2, true ]

Fix

For now, I've locked my firebase-admin at version 5.4.2, which prevents the error, but also prevents upgrading.

Hopefully you can fix this in the next version.

Thanks!

Most helpful comment

I faced the same issue. try to remove node_modules and install again. It worked for me.

All 12 comments

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

I faced the same issue. try to remove node_modules and install again. It worked for me.

Issue Template:

[READ] Step 1: Are you in the right place?

  • For issues or feature requests related to __the code in this repository__
    file a Github issue. - YES

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Mac OS 10.12.6
  • Firebase SDK version: 5.4.2 installed鈥攁ttempting to install 5.4.3
  • Library version: 5.4.2 installed鈥攁ttempting to install 5.4.3
    (how is the "Library version" different from the "Firebase SDK version"?)
  • Firebase Product: N/A - problem is installing the library, not using it
    Once I install it, I would like to use it for database and auth

[REQUIRED] Step 3: Describe the problem

I am attempting to install firebase-admin version 5.4.3 through NPM.

Steps to reproduce:

In a project using NPM packages, install firebase-admin version 5.4.2. Then run npm update to attempt to install firebase-admin version 5.4.3. On my system it fails with the error message posted above. I tried completely removing my node_modules directory and reinstalling everything, but got the same error.

However, other people don't appear to be having the exact same symptoms, so it's possible you won't be able to reproduce it, which is why I posted my other installed NPM packages along with the full error message and relevant section of the log file above.

Relevant Code:

See initial post, above.

What if you directly install the latest version of firebase-admin, instead of going the update route? Can't you just specify firebase-admin 5.4.3 as a dependency in your package.json?

Yes, that works. This definitely appears to be a problem _updating_, not installing.

Based on @thakkaryash94's and @hiranya911's comments, I unlocked my version of firebase-admin (changing it in package.json from "5.4.2" to "^5.4.2"), deleted my node_modules directory again, and did a clean npm install. And this time it re-installed everything without error.

Apparently the problem last time was that my firebase-admin version had been locked to "5.4.2", so after I reinstalled everything else, I still had to to upgrade from version 5.4.2 to 5.4.3 as a separate action, which gave me the error again. So, at least for me, updating from a previous version causes the error, but a clean install does not. (Though this person appears to have gotten a very similar error while doing a regular install, so it might act differently on different systems.)

So my personal problem is fixed. But I don't know whether you still need to change something to prevent this from happening again in future upgrades. (Having to delete node_modules and reinstall for every upgrade would get annoying, though I suppose I could live with it if I had to.) I'll let you decide if you think this issue should be closed immediately or warrants further investigation.

Thanks for the help!

Firebase rocks. Keep up the good work. :-)

Thanks @dschnelldavis for the update.

I was able to reproduce the issue with npm update, but have no idea what caused it or how to fix it. The most likely reason I can think of is that the npm-shrinkwrap files shipped with the 2 versions have slightly different formats (likely due to the releases being packaged from 2 versions of NPM). We've been thinking about pulling the shrinkwraps from the release artifacts, so that will probably clear this up.

Actually, if your theory is correct, this may no longer be an issue.

Assuming the change in npm-shrinkwrap caused the problem (which seems reasonable), then users of version 5.4.3 or above will never have this problem again (unless you change the npm-shrinkwrap file formats again in a future version).

The only people who will encounter this bug are people with version 5.4.2 or earlier who are upgrading to version 5.4.3 or later. And they can fix it by deleting their node_modules directory and running npm install鈥攐nce鈥攖hen it will never bother them again.

If that's the case, I'd say temporarily adding a note to your readme warning current users about the potential problem and its solution would be plenty.

(Or, if you got rid of the npm-shrinkwrap files instead, then you wouldn't even need the readme note. That's up to you. As a user, I'd be perfectly satisfied with either solution.)

Hi guys. Just to share my experience as I've been through the exact same error using npm v4.6.1 with npm install --save firebase-admin (last version being 5.4.3 at the present time).

I had to update npm to npm 5 (v5.5.1) to install the package.

Cheers!

Thanks all for the comments. We have removed the shrinkwrap file, and future releases will not ship with one. This should not cause issues in the future.

OS X 10.12.x

1) sudo rm -rf /usr/local/lib/node_modules
2) Install Stable Node.js from https://nodejs.org/dist/v8.9.4/node-v8.9.4.pkg
3) sudo npm install --unsafe-perm -g firebase-tools
4) firebase init 5) firebase serve --only functions,hosting

The key for me was to completely delete node_modules directory from /usr/local/lib, and reinstall firebase-tools using the --unsafe-perm command line option. No other suggestion worked.

Hope this helps.

UPDATE 03/18/2016:
Doing a fresh clean install on OS X 10.14 I now realize this method is really not a good one, more importantly at the time of this writing not sure how well Node.js 8 was supported. Installing Node modules globally is not necessary and as it is not necessary, it's also not a good idea / security risk.

I started using NVM (Node Version Manager) and it can simply be installed using the command:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

Using NVM installed node 6.x which I believe is still Google's preferred Node version though they do seem to be adding 8 support. Once NVM is installed simply:
nvm install v6.11.5

From there getting firebase initialized and working was as simple as following the documentation. Th 10.12 box I was using was old, and must have had a lot of cache trash on it to be a good example here.

I got this error for adding firebase plugin
plugin : npm install [email protected] firebase --save

npm ERR! code ENOLOCAL
npm ERR! Could not install from "firebase" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\system1\AppData\Roamingnpm-cache_logs\2019-03-18T06_56_58_886Z-debug.log

Was this page helpful?
0 / 5 - 0 ratings