remy/nodemon

EPERM: operation not permitted

catamphetamine opened this issue · 11 comments

G:\work\webapp\node_modules\configstore\index.js:62
                                throw err;
                                ^

Error: EPERM: operation not permitted, rename 'C:\Users\Nikolay\.config\configstore\update-notifier-nodemon.json.43afcf7
211ad51a0df5533152f862c5a' -> 'C:\Users\Nikolay\.config\configstore\update-notifier-nodemon.json'
    at Error (native)
    at Object.fs.renameSync (fs.js:686:18)
    at Function.writeFileSync [as sync] (G:\work\webapp\node_modules\write-file-atomic\index.js:39:12)
    at Object.create.all.set (G:\work\webapp\node_modules\configstore\index.js:55:21)
    at Object.Configstore (G:\work\webapp\node_modules\configstore\index.js:20:11)
    at new UpdateNotifier (G:\work\webapp\node_modules\update-notifier\index.js:34:17)
    at module.exports (G:\work\webapp\node_modules\update-notifier\index.js:123:23)
    at Object.<anonymous> (G:\work\webapp\node_modules\nodemon\bin\nodemon.js:15:27)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)

I'm having this error randomly.
Usually the first time I run nodemon.
The second try works.
(I'm running 4 nodemons in parallel if it matters)

I've tried setting the aforementioned folder's permissions but it didn't take effect.

remy commented

Yeah, they're all trying to access the config setting for the update notification. If you can stagger the booting of the 4 nodemons, maybe it'll help?

Ok, i'll think about it.
What's the purpose of that update-notifier-nodemon.json?

{
    "optOut": false,
    "lastUpdateCheck": 1446130789033
}
remy commented

To keep nodemon up to date.

You can disable it using this
https://github.com/yeoman/update-notifier/blob/master/readme.md#user-settings

On Thu, 29 Oct 2015 19:03 Nikolay notifications@github.com wrote:

Ok, i'll think about it.
What's the purpose of that update-notifier-nodemon.json?


Reply to this email directly or view it on GitHub
#709 (comment).

Oh, I see, so it constantly checks for updates like Google Chrome does.
Ok, thanks, I'll add the update-notifier-nodemon.yml file there.

optOut: true

The .yml file (suggested by the link) didn't work.
I tried update-notifier-nodemon.json and it seems working

{
    "optOut": true
}

Nope, it didn't work.

Error: EPERM: operation not permitted, rename 'C:\Users\Nikolay\.config\configstore\update-notifier-nodemon.json.b6f8bf0
69378d42570928fce0878960a' -> 'C:\Users\Nikolay\.config\configstore\update-notifier-nodemon.json'

Since there's no way to prevent nodemon from writing that update-notifier-nodemon.json file, here's my workaround for those who google

    "development-api-server": "nodemon ./code/api/entry.js",
    "development-page-server": "nodemon ./code/page-server/entry.js",
    "development-page-server-delayed": "npm-run-all delay development-page-server",
    "development-image-server": "nodemon ./code/image-server/entry.js",
    "development-image-server-delayed": "npm-run-all double-delay development-image-server",
    "development-web-server": "nodemon ./code/web-server/entry.js",
    "development-web-server-delayed": "npm-run-all triple-delay development-web-server",
    "delay": "node ./code/sleep 1000",
    "double-delay": "node ./code/sleep 2000",
    "triple-delay": "node ./code/sleep 3000",
    "development-server": "npm-run-all --parallel development-api-server development-page-server-delayed development-image-server-delayed development-web-server-delayed",
var args = process.argv.slice(2)

var delay = args[0]

if (typeof delay === 'undefined')
{
    return console.error('[sleep] delay (in ms) not specified')
}

if (delay != parseInt(delay))
{
    return console.error('[sleep] invalid delay: "' + delay + '"')
}

console.log('[sleep] sleeping for ' + delay + ' milliseconds')

setTimeout(function()
{
    console.log('[sleep] woken up')
    process.exit(0)
},
delay)

update-notifier/index.js:48 has

    if (this.config.get('optOut') || 'NO_UPDATE_NOTIFIER' in process.env || process.argv.indexOf('--no-update-notifier') !== -1) {
        return;
    }

So I configured my shell Git for Windows
with export NO_UPDATE_NOTIFIER=true and that worked.

I can also confirm that appending the option to your nodemon command works too.

    "watch:build:scripts": "nodemon --watch src/ --ext * --exec \"npm run build:scripts\" --no-update-notifier",

Suggested solution above doesn't work. When launching multiple nodemon processes with --no-update-notifier argument there is still EPERM: operation not permitted renaming update-notifier-nodemon.json.{some-string} to update-notifier-nodemon.json

It's due to the fact that in update-notifier package from nodemon's package.json (0.5.0) there is always writing-file-async in Configstore constructor in UpdateNotifier constructor (line 34), so the flag doesn't work.

It is solved in update-notifier package in newer versions (eg. 2.2.0) and --no-update-notifier has influence there on creating Configstore, while it's public conctract remains untouched.
I'm asking for upgrading update-notifier package depenendency in nodemon's package.json for solving this problem.

I have this same issue, running node in docker. I get

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node /app/app.js`
[nodemon] Internal watch failed: EPERM: operation not permitted, stat '/proc/1/map_files/400000-4f2000'

Node: 8.4.0
NPM: 5.3.0
Nodemon: 1.11.0

Hopefully @padzikm or someone gets a fix soon.

This issue mainly focuses on the update-notifier-nodemon file. The issue I am seeing is the same as @tim15 . I am using docker-compose, node:6.11.5-slim, and nodemon with this issue:

Any ideas what is causing this one?

[nodemon] 1.12.1
api_1         | [nodemon] to restart at any time, enter `rs`
api_1         | [nodemon] watching: *.*
api_1         | [nodemon] starting `node server.js`
api_1         | [nodemon] Internal watch failed: EPERM: operation not permitted, stat '/proc/1/map_files/400000-4f2000'