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

Error when running emulator: "EPERM: operation not permitted, rename..." #1112

Closed
Metsuryu opened this issue Jan 18, 2019 · 28 comments
Closed

Comments

@Metsuryu
Copy link

Metsuryu commented Jan 18, 2019

Sometimes, when I run firebase functions:shell or firebase serve --only functions to start the local emulator, this is the error I get (without --debug):

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.538670987' -> 'C:\Users\Metsuryu\.config\configstore\fi
rebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Sometimes it doesn't happen, I wasn't able to figure out why it only happens sometimes. Disabling the antivirus doesn't seem to work consistently.

[REQUIRED] Environment info

firebase-tools: 6.3.0

I'm using 6.3.0 both globally, and in the functions' package.json. The problem started happening only after I started using it in the cloud functions.

Platform: Windows

[REQUIRED] Steps to reproduce

After installing firebase-tools, and importing it in the cloud functions, like this:

import * as firebase_tools from "firebase-tools";

executing a command to start the local emulator (firebase functions:shell or firebase serve --only functions) will sometimes not work, showing the above error.

Removing import * as firebase_tools from "firebase-tools"; solves the problem, so I am fairly sure firebase-tools is causing it.

[REQUIRED] Expected behavior

The local emulator should start properly every time.

[REQUIRED] Actual behavior

The local emulator starts only sometimes, and other times it throws an error.
Here is the output with --debug:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea>firebase functions:s
hell --debug
[2019-01-18T08:07:55.767Z] -----------------------------------------------------
-----------------
[2019-01-18T08:07:55.771Z] Command:       C:\Program Files\nodejs\node.exe C:\Us
ers\Metsuryu\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js
 functions:shell --debug
[2019-01-18T08:07:55.772Z] CLI Version:   6.3.0
[2019-01-18T08:07:55.772Z] Platform:      win32
[2019-01-18T08:07:55.772Z] Node Version:  v10.15.0
[2019-01-18T08:07:55.773Z] Time:          Fri Jan 18 2019 09:07:55 GMT+0100 (GMT
+01:00)
[2019-01-18T08:07:55.774Z] -----------------------------------------------------
-----------------

[2019-01-18T08:07:55.783Z] > command requires scopes: ["email","openid","https:/
/www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis
.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-01-18T08:07:55.786Z] > authorizing via signed-in user
[2019-01-18T08:07:55.786Z] [iam] checking project new-lantea for permissions ["f
irebase.projects.get"]
[2019-01-18T08:07:55.788Z] >>> HTTP REQUEST POST https://cloudresourcemanager.go
ogleapis.com/v1/projects/new-lantea:testIamPermissions
 permissions=[firebase.projects.get]
[2019-01-18T08:07:56.710Z] <<< HTTP RESPONSE 200 content-type=application/json;
charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 18 Jan
2019 08:07:53 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=b
lock, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic="
:443"; ma=2592000; v="44,43,39,35", accept-ranges=none, transfer-encoding=chunke
d
i  functions: Preparing to emulate functions.
[2019-01-18T08:07:57.342Z] Fetching environment
[2019-01-18T08:07:57.344Z] >>> HTTP REQUEST GET https://cloudresourcemanager.goo
gleapis.com/v1/projects/new-lantea

[2019-01-18T08:07:58.206Z] <<< HTTP RESPONSE 200 content-type=application/json;
charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 18 Jan
2019 08:07:55 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=b
lock, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic="
:443"; ma=2592000; v="44,43,39,35", accept-ranges=none, transfer-encoding=chunke
d
[2019-01-18T08:07:58.210Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.
com/v1/projects/260007026360:getServerAppConfig

[2019-01-18T08:07:58.522Z] <<< HTTP RESPONSE 200 content-type=application/json;
charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 18 Jan
2019 08:07:55 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=b
lock, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic="
:443"; ma=2592000; v="44,43,39,35", accept-ranges=none, transfer-encoding=chunke
d
[2019-01-18T08:07:58.525Z] Starting @google-cloud/functions-emulator
Warning: You're using Node.js v10.15.0 but Google Cloud Functions only supports
v6.11.5.
[2019-01-18T08:08:01.162Z] Parsing function triggers
[2019-01-18T08:08:02.968Z] Deploying functions locally
[2019-01-18T08:08:02.969Z] Deploying functions locally
[2019-01-18T08:08:02.969Z] Deploying functions locally
[2019-01-18T08:08:02.976Z] Deploying functions locally
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
error: D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\nod
e_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.3792409641' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error: D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\nod
e_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.4192902253' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error: D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\nod
e_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.3609321230' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error: D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\nod
e_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.132014655' -> 'C:\Users\Metsuryu\.config\configstore\fi
rebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error: D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\nod
e_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.1807046972' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error: D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\nod
e_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.2830257114' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error: Function worker crashed with exit code: 1
error: Function worker crashed with exit code: 1
error: Function worker crashed with exit code: 1
error: Function worker crashed with exit code: 1
error: Function worker crashed with exit code: 1
error: Function worker crashed with exit code: 1
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
+  functions: updateUserData
+  functions: issueArticleAward
+  functions: changeTransactionStatus
+  functions: daily_job
+  functions: tenmin_job
+  functions: monthly_job
+  functions: addToArticleComments
+  functions: editComment
+  functions: removeComment
+  functions: voteComment
+  functions: deleteArticle
+  functions: likeOrFavorite
+  functions: followUser
+  functions: functionsTest
+  functions: updateFollowerImage
+  functions: addDraft
+  functions: addArticleToSearchIndex
+  functions: addArticle
+  functions: hideEveryArticleByUser
+  functions: savePushSubscription
+  functions: sendCustomEmailsToUsersList
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
info: analyticsAPI initialized
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.1807046972' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3), errors=[Fun
ction worker crashed with exit code: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.1807046972' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.3792409641' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3), errors=[Fun
ction worker crashed with exit code: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.3792409641' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.2830257114' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3), errors=[Fun
ction worker crashed with exit code: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.2830257114' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.3609321230' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3), errors=[Fun
ction worker crashed with exit code: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.3609321230' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.4192902253' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3), errors=[Fun
ction worker crashed with exit code: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.4192902253' -> 'C:\Users\Metsuryu\.config\configstore\f
irebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
error:  code=500, status=INTERNAL, message=Function worker crashed with exit cod
e: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.132014655' -> 'C:\Users\Metsuryu\.config\configstore\fi
rebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3), errors=[Fun
ction worker crashed with exit code: 1
undefinedD:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lantea\functions\n
ode_modules\firebase-tools\node_modules\configstore\index.js:69
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Metsuryu\.config\configs
tore\firebase-tools.json.132014655' -> 'C:\Users\Metsuryu\.config\configstore\fi
rebase-tools.json'
    at Object.renameSync (fs.js:594:3)
    at Function.writeFileSync [as sync] (D:\Users\Metsuryu\Desktop\Dev\Proj
ects\Work\new-lantea\functions\node_modules\firebase-tools\node_modules\write-fi
le-atomic\index.js:124:8)
    at Configstore.set (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:62:2
1)
    at new Configstore (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-lan
tea\functions\node_modules\firebase-tools\node_modules\configstore\index.js:27:1
1)
    at Object.<anonymous> (D:\Users\Metsuryu\Desktop\Dev\Projects\Work\new-
lantea\functions\node_modules\firebase-tools\lib\configstore.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)]
+  functions: getLanteaIDFromForumID
+  functions: deleteAccount
+  functions: sendReport
+  functions: incrementArticleViews
+  functions: saveToDatabaseLogsCF
+  functions: setArticleVisibility
+  functions: setAsArticleInSpotlight
+  functions: updateArticleSearchIndex
+  functions: sendPaymentRequestEmail
+  functions: sendNotification
!  functions: Error from emulator. [object Object]
[2019-01-18T08:11:13.732Z]
firebase >

And I can't use the functions when it errors like this, so I have to retry until it works.

@bkendall
Copy link
Contributor

Couple things to try:

  1. Downgrade your node version to 8 and see if you still get the same issues.
  2. On Windows, we've seen cases where working across differently named drives (C and D in this case) can cause odd issues. If you copy your workspace to C and try the same (so that the code you're running and firebase-tools are coming from the same drive (C)), do you see the same problem?

@bkendall
Copy link
Contributor

(and thank you for the very detailed report - it helps when all that information is included 😄)

@Metsuryu
Copy link
Author

Metsuryu commented Jan 18, 2019

I'll try tomorrow, thank you! And yeah, the different drives thing came to mind, but I didn't try it, I thought it was a bit far-fetched ahah.

@mbleigh
Copy link
Contributor

mbleigh commented Jan 18, 2019

Do you have any user restrictions on your machine? This seems to be a filesystem permissions issue, not directly an issue with the Firebase CLI. Is there a reason you might not have write permission to the C:\Users\Metsuryu\.config\configs tore directory?

@Metsuryu
Copy link
Author

@mbleigh no idea. I'm using the administrator user, and I'm even running the cmd window as admin, and I've even removed the "read-only" check from all the involved folders, if any.

Since it's trying to rename 'firebase-tools.json.538670987' to 'firebase-tools.json', then I thought it might have created the firebase-tools.json.538670987' with a read-only attribute somehow.

@Metsuryu
Copy link
Author

Metsuryu commented Jan 19, 2019

Alright, downgrading node to version 8 didn't fix it, (it actually broke my GitHub Desktop and I had to re-install it, so maybe I should file a bug report for that too, but I have work to do).

Moving the folder to the drive C also failed.

Edit: For now, as a work-around I'm just disabling firebase-tools when I run the local emulator, but that's not ideal, since I can't test the functions that use it now.

@bkendall
Copy link
Contributor

Your node installation is on the same drive as your code?

You've definitely got me stumped. Without sitting down at your machine and debugging, it's gonna be hard to really describe. If you go into the installed code for firebase-tools you might be able to squeeze out more information about why it's failing.

Maybe, just maybe, blowing away the folder in which that file lives might help so that it can be recreated. Other than that, I feel like I might be just grasping at straws...

@Metsuryu
Copy link
Author

@bkendall It wasn't on the same drive, but I tried moving it to the same drive (C) and it din't work either.
What do you mean by "blowing away" the folder? Deleting it, and reinstalling it? I've tried that, didn't help. At least, for the local version, not for the global version, so maybe I could try that?

@bkendall
Copy link
Contributor

Yes - deleting it. :)

Try it with the global version. Are you normally running the emulator through a npm script? Double check the versions that you're using in both places as well?

@Metsuryu
Copy link
Author

I'll try it now.

Normally I run it with firebase functions:shell from the console.

The versions seem to be the same both globally and locally:

C:\Users\Metsuryu>firebase --version
6.3.0

@bkendall
Copy link
Contributor

You've got me baffled. You may have better luck on Stack Overflow asking this question as that usually has more traffic going by it.

@Metsuryu
Copy link
Author

Alright, I tried reinstalling the global one, and the problem persists.

Ah, I was banned from asking new questions on SO a while ago, it's a pain making a new account. I guess I'll just use the workaround until it's fixed.

Maybe completely reinstalling everything from scratch on a new system might fix it, since apparently I'm the only one having this problem, so I might try that some day.

@bkendall
Copy link
Contributor

Okay. Sorry I can't be of more help. If you discover the issue, let us know!

@kaminskypavel
Copy link

@Metsuryu are you by any chance running this from a non-admin cmd? (maybe inside webstorm or something like this)

@Metsuryu
Copy link
Author

Metsuryu commented Feb 6, 2019

@kaminskypavel I'm running the cmd from an admin account, and even clicking "Run as Admin" form the context menu.

@kaminskypavel
Copy link

kaminskypavel commented Feb 6, 2019

@Metsuryu happened to me as well, but running from an elevated cmd did the trick

@Metsuryu
Copy link
Author

Metsuryu commented Feb 7, 2019

@kaminskypavel doesn't seem to change anything for me.

@CamWass
Copy link

CamWass commented Feb 9, 2019

I suffered from this problem too, and it seems to be common across node/npm. For me, removing functions/node_modules in my project directory, then running npm i (this is basically just a reinstall of all modules) fixed the problem.

If that doesn't help, these threads might be useful:

TL;DR:

Run npm cache clean

Failing that:

Close all editors and node processes and try again.

Failing that:

Disable your anti-virus and try again.

@Metsuryu
Copy link
Author

Metsuryu commented Feb 9, 2019

@CamWass Unfortunately, I had already tried that multiple times, even with cache clean, and -force, but it didn't work.

Anyway, I'll take a look at those links, thanks.

@dsl101
Copy link

dsl101 commented Feb 14, 2019

Same challenge here (this is the second time it's happened). Tried all those solutions the first time, and nothing worked save creating a 'clean' firebase project and then moving all the sources across, reinstalling all the extra packages, etc. Eventually got it back to where I was. Now it's happened again, and I'm going straight to that. firebase functions:shell has also started taking 3–4 minutes to (fail to) start.

@dsl101
Copy link

dsl101 commented Feb 14, 2019

And, I thought I'd just try one more thing... I deleted /node_modules from the /firebase folder, (not the /functions subfolder), and suddenly it's started working again. I don't know if that's connected, and since there's no package.json file in the main /firebase folder, there was nothing to reinstall. In fact, I'm not sure how that folder got there in the first place. But might be worth checking you don't have one lurking in there.

For the record, firebase functions:shell is still taking much longer to start than it used to (with node.exe running at 100% during that startup time), but I strongly suspect that's a different issue.

@Metsuryu
Copy link
Author

@dsl101 Where is this /firebase folder you deleted? In the project's folder?

@dsl101
Copy link

dsl101 commented Feb 14, 2019

Sorry—my bad. /firebase referred to the root of the firebase project itself (just bad naming for my test project :). So, to be clear:

/some/project/                         ← Root of Firebase project
/some/project/node_modules/            ← Don't know where this came from, deleting fixed my issue
/some/project/functions/               ← Firebase functions subdirectory
/some/project/functions/node_modules/  ← Can be removed and recreated with 'npm i'

@mareks76
Copy link

mareks76 commented Aug 5, 2020

Had the same problem. What worked for me was to close Visual Studio Code, and then run npm i firebase in a normal (non admin) powershell window. Then it installed without problems. Seems that both Visual Studio Code and Atom locks some files.

@ccimpoi
Copy link

ccimpoi commented Oct 28, 2020

Had the same problem. What worked for me was to close Visual Studio Code, and then run npm i firebase in a normal (non admin) powershell window. Then it installed without problems. Seems that both Visual Studio Code and Atom locks some files.

For me just opening the offending file (./functions/package.json in my case), making a small edit and saving it released the VSCode lock.

@Tommertom
Copy link

For anyone bumping into this page Googling the error - I had the same problem when closing down Firebase emulator on a windows 10 machine. In my case it is a locking problem caused by either vscode, npm run dev (functions/react app), I can avoid the issue by closing down the emulator last (after closing vscode, npm dev in home, and npm run dev in functions) - I am using three separate terminal windows to run these processes.

@pyramid-scheme-ceo
Copy link

Running into the same issue here as @Tommertom after closing down the auth emulator attempting to use the --export-on-exit=./firebase-data flag.

None of the suggested fixes worked for me - clearing npm cache, running terminal as admin, closing it last, etc.

@pyramid-scheme-ceo
Copy link

...and found it immediately after posting (+ the hours of searching for the cause before posting) -- always the way!

So I'm running Expo/React Native and the Expo process is watching the entire project directory, but even when you close that process first it still seems to keep the lock on all the files for a while (or maybe it's something to do with the Expo watch running over the Firebase data files at the start when the emulators are started and the initial data is brought in via the --import flag...)

Either way, fixed by just exporting to/importing from a directory at least up one level from the main project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants