sfpowerkit
sfpowerkit copied to clipboard
Install of [email protected] fail on windows host
Describe the bug The installation of [email protected] with npm fail with permission error: EPERM: operation not permitted
To Reproduce Steps to reproduce the behavior:
- npm i [email protected]
Expected behavior the package should be installed
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: windows 10 19044
- Node Version v16.13.2
- Version of sfpowerkit 4.1.5
Additional context
💻P2019-028 📂~
❯_ ❯ mkdir test
Directory: C:\Users\ajaouen
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 09/03/2022 11:58 1 test
💻P2019-028 📂~
❯_ ❯ cd .\test\
💻P2019-028 📂~/test
❯_ ❯ npm i [email protected]
npm ERR! code 1
npm ERR! path C:\Users\ajaouen\test\node_modules\sfpowerkit\node_modules\better-sqlite3
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Les projets sont générés individuellement dans cette solution. Pour activer la génération en parallèle, ajoutez le commutateur "-m".
npm ERR! symlink_builtin_sqlite3
npm ERR! node:internal/fs/utils:344
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! CUSTOMBUILD : error : EPERM: operation not permitted, symlink 'C:\Users\ajaouen\test\node_modules\sfpowerkit\node_modules\better-sqlite3\deps\sqlite3\sqlite3.c' -> 'C:\Users\ajaouen\test\node_modules\sfpowerkit\node_modules\better-sqlite3\build\Release\obj\global_intermediate\sqlite3\sqlite3.c' [C:\Users\ajaouen\test\node_modules\sfpowerkit\node_modules\better-sqlite3\build\deps\locate_sqlite3.vcxproj]
npm ERR! at Object.symlinkSync (node:fs:1651:3)
npm ERR! at Object.<anonymous> (C:\Users\ajaouen\test\node_modules\sfpowerkit\node_modules\better-sqlite3\deps\symlink.js:18:5)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR! at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR! at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR! at node:internal/main/run_main_module:17:47 {
npm ERR! errno: -4048,
npm ERR! syscall: 'symlink',
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\ajaouen\\test\\node_modules\\sfpowerkit\\node_modules\\better-sqlite3\\deps\\sqlite3\\sqlite3.c',
npm ERR! dest: 'C:\\Users\\ajaouen\\test\\node_modules\\sfpowerkit\\node_modules\\better-sqlite3\\build\\Release\\obj\\global_intermediate\\sqlite3\\sqlite3.c'
npm ERR! }
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.7.4 found at "C:\Python\Python37-32\python.exe"
npm ERR! gyp info find VS using VS2019 (16.3.29318.209) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:23892) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn C:\Python\Python37-32\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\ajaouen\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\ajaouen\\test\\node_modules\\sfpowerkit\\node_modules\\better-sqlite3\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\ajaouen\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\ajaouen\\AppData\\Local\\node-gyp\\Cache\\16.13.2\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\ajaouen\\AppData\\Local\\node-gyp\\Cache\\16.13.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\ajaouen\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\ajaouen\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.2\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\Users\\ajaouen\\test\\node_modules\\sfpowerkit\\node_modules\\better-sqlite3',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\\Users\\ajaouen\\test\\node_modules\\sfpowerkit\\node_modules\\better-sqlite3\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\ajaouen\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ajaouen\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\ajaouen\test\node_modules\sfpowerkit\node_modules\better-sqlite3
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ajaouen\AppData\Local\npm-cache\_logs\2022-03-09T10_58_59_368Z-debug.log
Hello @alanJaouen Can you check whether these instructions fixes your problem https://stackoverflow.com/questions/35293117/npm-install-that-requires-node-gyp-fails-on-windows
Hi @azlam-abdulsalam,
Unfortunatly, this doesnt work as I don't have admin right on my computer:
npm install -g windows-build-tools
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm ERR! code 1
npm ERR! path C:\Users\ajaouen\AppData\Roaming\npm\node_modules\windows-build-tools
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./dist/index.js
Downloading python-2.7.15.amd64.msi
npm ERR! [============================================>] 100.0% of 20.2 MB (10.1 MB/s)
npm ERR! Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\ajaouen\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
npm ERR! [============================================>] 100.0% of 1.12 MB (1.12 MB/s)
npm ERR! Downloaded vs_BuildTools.exe. Saved to C:\Users\ajaouen\.windows-build-tools\vs_BuildTools.exe.
npm ERR!
npm ERR! Starting installation...
npm ERR! Please restart this script from an administrative PowerShell!
npm ERR! The build tools cannot be installed without administrative rights.
npm ERR! To fix, right-click on PowerShell and run "as Administrator".
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ajaouen\AppData\Local\npm-cache\_logs\2022-03-14T08_49_59_949Z-debug.log
Hi @alanJaouen,
I reviewed the logs from my end and my team looks like it's a matter of needing to run this installation "as Administrator" if you are able to reach out to your team to enable your admin to run this that should resolve this issue.
Hi @henry88lay,
We share the same analysis internaly, I have access to admin right on my computer, but I can't give these access to all the developer in my team, as it will be a HUGE security breach. And I can't make them wait on the IT team each time they want to run an npm install
command.
furthermore, I don't understand why you need administrative right to install a dependency of a sfdx plugin,
@alanJaouen This is due to a dependency used by sfpowerkit, better-sqlite3. You can refer to the issue here.
https://github.com/JoshuaWise/better-sqlite3/issues/72
As the dependency utilizes C++ bindings, it needs these native node addons to be installed in the target system.
We will look into how we can better address it
I am closing this issue since the issue is because of a dependency, rather than an issue created by the sfpowerkit plugin.