firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

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

Open Metsuryu opened this issue 7 years ago • 29 comments

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.

Metsuryu avatar Jan 18 '19 08:01 Metsuryu

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 avatar Jan 18 '19 15:01 bkendall

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

bkendall avatar Jan 18 '19 15:01 bkendall

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.

Metsuryu avatar Jan 18 '19 15:01 Metsuryu

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?

mbleigh avatar Jan 18 '19 20:01 mbleigh

@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 avatar Jan 18 '19 20:01 Metsuryu

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.

Metsuryu avatar Jan 19 '19 12:01 Metsuryu

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...

bkendall avatar Jan 22 '19 21:01 bkendall

@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?

Metsuryu avatar Jan 22 '19 21:01 Metsuryu

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?

bkendall avatar Jan 22 '19 21:01 bkendall

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

Metsuryu avatar Jan 22 '19 22:01 Metsuryu

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.

bkendall avatar Jan 22 '19 22:01 bkendall

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.

Metsuryu avatar Jan 22 '19 22:01 Metsuryu

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

bkendall avatar Jan 24 '19 20:01 bkendall

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

kaminskypavel avatar Feb 06 '19 18:02 kaminskypavel

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

Metsuryu avatar Feb 06 '19 18:02 Metsuryu

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

kaminskypavel avatar Feb 06 '19 18:02 kaminskypavel

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

Metsuryu avatar Feb 07 '19 09:02 Metsuryu

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:

  • https://github.com/react-community/create-react-native-app/issues/191
  • https://github.com/npm/npm/issues/10826
  • https://blogs.msdn.microsoft.com/matt-harrington/2012/02/23/how-to-fix-node-js-npm-permission-problems/

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.

CamWass avatar Feb 09 '19 06:02 CamWass

@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.

Metsuryu avatar Feb 09 '19 11:02 Metsuryu

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 avatar Feb 14 '19 09:02 dsl101