Node-sass: `binding.node` cannot be removed when node is running

Created on 6 Dec 2018  Â·  9Comments  Â·  Source: sass/node-sass

  • NPM version (npm -v): 6.4.1
  • Node version (node -v): v10.13.0
  • Node Process (node -p process.versions):
    js { http_parser: '2.8.0', node: '10.13.0', v8: '6.8.275.32-node.36', uv: '1.23.2', zlib: '1.2.11', ares: '1.14.0', modules: '64', nghttp2: '1.34.0', napi: '3', openssl: '1.1.0i', icu: '62.1', unicode: '11.0', cldr: '33.1', tz: '2018e' }
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
    node-sass 4.10.0 (Wrapper) [JavaScript] libsass 3.5.4 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass):
    `-- [email protected] `-- [email protected] `-- [email protected]

I'm using node-sass in one of my projects and I found myself unable to delete binding.node after requiring node-sass.

I'm using a yeoman-generator for generating a nodejs-module which utilizes node-sass.
During the unit-tests I'm running the generated module in order to ensure everything is working as expected.

But when I try to delete the generated module I'm getting an error

Error: EPERM: operation not permitted, unlink 'C:\Users\manuth\AppData\Local\Temp\58aad6032a28ab24e7b28565ba37bb9b714fe210\node_modules\node-sass\vendor\win32-x64-64\binding.node'
Invalid - By Design

Most helpful comment

In my case, i killed all nodejs running processes and it worked.

All 9 comments

Looks like a local permission issue. Maybe you ran npm install with a
privileged account. This is nothing to do with node-sass.

On Fri., 7 Dec. 2018, 12:21 am Manuel Thalmann <[email protected]
wrote:

>

  • NPM version (npm -v): 6.4.1
  • Node version (node -v): v10.13.0
  • Node Process (node -p process.versions):

    { http_parser: '2.8.0',
    node: '10.13.0',
    v8: '6.8.275.32-node.36',
    uv: '1.23.2',
    zlib: '1.2.11',
    ares: '1.14.0',
    modules: '64',
    nghttp2: '1.34.0',
    napi: '3',
    openssl: '1.1.0i',
    icu: '62.1',
    unicode: '11.0',
    cldr: '33.1',
    tz: '2018e' }

  • Node Platform (node -p process.platform): win32

  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):

    node-sass 4.10.0 (Wrapper) [JavaScript]
    libsass 3.5.4 (Sass Compiler) [C/C++]

  • npm node-sass versions (npm ls node-sass):

    -- [email protected] -- [email protected]
    `-- [email protected]

I'm using node-sass in one of my projects and I found myself unable to
delete binding.node after requiring node-sass.

I'm using a yeoman-generator for generating a nodejs-module which
utilizes node-sass.
During the unit-tests I'm running the generated module in order to ensure
everything is working as expected.

But when I try to delete the generated module I'm getting an error

Error: EPERM: operation not permitted, unlink 'C:\Users\manuth\AppData\Local\Temp\58aad6032a28ab24e7b28565ba37bb9b714fe210\node_modulesnode-sass\vendor\win32-x64-64binding.node'

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/2557, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWPtA6WHL0YcxhMUQUZ1NFMw7vJY_ks5u2Rm9gaJpZM4ZGfqt
.

This is not a permission issue.
Even Windows Explorer (elevated as SYSTEM which is equal to root) says "this file is open in Node.js: Server-side JavaScript"

image

Please reopen the issue

I now have this issue too, only with node-sass.

I totally forgot to mention the final "solution".
As mentioned in my Issue that I opened in node/nodejs these .node-files are just acting like .dll-files, which means:

Once a native library has been required the file cannot be deleted until the process exits as this is the natural behavior of Windows.

I could fix it by creating a junction-link to my own module's installation of the native module's directory:
Have a look at this

This issue would not let me successfully run an npm ci as the node_modules folder could not be deleted because of the binding. A temporary workaround that worked for me was to open up the task manager and just close all node.exe instances

It's deleted for me after I stop the dev server, hope it can help :)

In my case, i killed all nodejs running processes and it worked.

I killed my reactjs processess and it worked

In my case, i killed all nodejs running processes and it worked.

This worked for me too! Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NathanKleekamp picture NathanKleekamp  Â·  4Comments

samayo picture samayo  Â·  3Comments

paulcpederson picture paulcpederson  Â·  3Comments

liuyuqiang picture liuyuqiang  Â·  3Comments

alexandrubau picture alexandrubau  Â·  3Comments