profile
viewpoint

Ask questionsnode-gyp: EPERM: operation not permitted, read

<!-- Thank you for reporting an issue. The more information you can give us, the better the chance we can fix your problem.

This issue tracker is for issues with node-gyp, if you have an issue installing a specific module, please file an issue on that module's issue tracker (npm issues modulename). -->

  • Node Version: node -v: v10.16.0 and npm -v: 6.9.0
  • Platform:
OS Name:                   Microsoft Windows 10 Home Single Language
OS Version:                10.0.17763 N/A Build 17763
System Type:              x64-based PC
  • Compiler:
msbuild : The term 'msbuild' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  • Module: robotjs

<details><summary>Verbose output (from npm or node-gyp):</summary>

C:\Projects\Kawosu!>npm i robotjs

> robotjs@0.5.1 install C:\Projects\Kawosu!\node_modules\robotjs
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=10.16.0 runtime=node arch=x64 platform=win32)

C:\Projects\Kawosu!\node_modules\robotjs>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: EPERM: operation not permitted, read
gyp ERR! stack     at Object.readSync (fs.js:498:3)
gyp ERR! stack     at tryReadSync (fs.js:332:20)
gyp ERR! stack     at Object.readFileSync (fs.js:361:19)
gyp ERR! stack     at Object.Module._extensions..js (internal/modules/cjs/loader.js:786:20)
gyp ERR! stack     at Module.load (internal/modules/cjs/loader.js:653:32)
gyp ERR! stack     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
gyp ERR! stack     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
gyp ERR! stack     at Module.require (internal/modules/cjs/loader.js:690:17)
gyp ERR! stack     at require (internal/modules/cjs/helpers.js:25:18)
gyp ERR! stack     at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\index.js:18:15)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Projects\Kawosu!\node_modules\robotjs
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
npm WARN kawosu@1.0.6 No description
npm WARN kawosu@1.0.6 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! robotjs@0.5.1 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the robotjs@0.5.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Projects\caches\npm-cache\_logs\2019-07-16T21_08_00_580Z-debug.log

C:\Projects\Kawosu!>

</details>

It says that this is a node-gyp bug. That's all I know. I don't know which directory it tries to access.

nodejs/node-gyp

Answer questions KittyLe

@bzoz, I don't know where to run env. Tried running it in npm and PowerShell. This is the output of windows-build-tools --verbose


npm info lifecycle chalk@2.4.2~postinstall: chalk@2.4.2
npm info lifecycle debug@4.1.1~postinstall: debug@4.1.1
npm info lifecycle fs-extra@8.1.0~postinstall: fs-extra@8.1.0
npm info lifecycle in-gfw@1.2.0~postinstall: in-gfw@1.2.0
npm info lifecycle nugget@2.0.1~postinstall: nugget@2.0.1
npm info lifecycle string-width@4.1.0~postinstall: string-width@4.1.0
npm info lifecycle windows-build-tools@5.2.2~postinstall: windows-build-tools@5.2.2

> windows-build-tools@5.2.2 postinstall C:\Projects\caches\npm\node_modules\windows-build-tools
> node ./dist/index.js

fs.js:114
    throw err;
    ^

Error: EPERM: operation not permitted, read
    at Object.readSync (fs.js:498:3)
    at tryReadSync (fs.js:332:20)
    at Object.readFileSync (fs.js:361:19)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:786:20)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\Projects\caches\npm\node_modules\windows-build-tools\node_modules\request\index.js:18:15)
npm verb lifecycle windows-build-tools@5.2.2~postinstall: unsafe-perm in lifecycle true
npm verb lifecycle windows-build-tools@5.2.2~postinstall: PATH: C:\Projects\caches\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Projects\caches\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Projects\caches\npm\node_modules\.bin;C:\Program Files (x86)\Embarcadero\Studio\19.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\19.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\Win64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\Java\jre1.8.0_211\bin;C:\Program Files\Java\jre1.8.0_60\bin;C:\Program Files\Java\jdk-12.0.1\bin;C:\Program Files\Java\jdk1.8.0_60\bin;C:\Program Files\nodejs\;C:\Users\KittyLe\AppData\Local\Microsoft\WindowsApps;C:\Users\KittyLe\AppData\Local\GitHubDesktop\bin;C:\Users\KittyLe\AppData\Local\atom\bin;C:\Users\KittyLe\AppData\Roaming\npm
npm verb lifecycle windows-build-tools@5.2.2~postinstall: CWD: C:\Projects\caches\npm\node_modules\windows-build-tools
npm info lifecycle windows-build-tools@5.2.2~postinstall: Failed to exec postinstall script
npm timing action:postinstall Completed in 515ms
npm verb unlock done using C:\Projects\caches\npm-cache\_locks\staging-812899af8a9afb84.lock for C:\Projects\caches\npm\node_modules\.staging
npm timing stage:rollbackFailedOptional Completed in 291ms
npm timing stage:runTopLevelLifecycles Completed in 10134ms
npm verb stack Error: windows-build-tools@5.2.2 postinstall: `node ./dist/index.js`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (C:\Projects\caches\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
npm verb stack     at EventEmitter.emit (events.js:198:13)
npm verb stack     at ChildProcess.<anonymous> (C:\Projects\caches\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:198:13)
npm verb stack     at maybeClose (internal/child_process.js:982:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
npm verb pkgid windows-build-tools@5.2.2
npm verb cwd C:\Windows\system32
npm verb Windows_NT 10.0.17763
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Projects\\caches\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "--production" "windows-build-tools" "--verbose"
npm verb node v10.16.0
npm verb npm  v6.10.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! windows-build-tools@5.2.2 postinstall: `node ./dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools@5.2.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 10915ms

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Projects\caches\npm-cache\_logs\2019-07-17T23_03_37_444Z-debug.log
PS C:\Windows\system32>
useful!

Related questions

Error: `gyp` failed with exit code: 1 at ChildProcess.onCpExit hot 4
gyp ERR! stack Error: `make` failed with exit code: 2 hot 2
npm install error on windows 10 hot 2
Fails on every npm install on macOS Mojave hot 2
Visual Studio finder is doing a case-sensitive path check hot 2
node-gyp rebuild failed hot 1
Node gyp build fails on node v12.1.0 hot 1
node-pre-gyp build fail error while installing with `npm install` or `npm install -d` hot 1
Is this an Issue with MACOS catalina? hot 1
gyp ERR! stack Error: `make` failed with exit code: 2 hot 1
Is this an Issue with MACOS catalina? hot 1
Is this an Issue with MACOS catalina? hot 1
Not able to build in osx 10.14.2 with java 10.0.1 hot 1
TypeError: '>=' not supported between instances of 'tuple' and 'str' hot 1
Breaks with VS2019 installed hot 1
source:https://uonfu.com/
Github User Rank List