node-gyp: throwing Could not find any Visual Studio installation to use on Windows
Current Behavior
npx create-react-app@3.4.1 my-app --scripts-version=@skyscanner/backpack-react-scripts --template @skyscanner/backpack --use-npm
or
npx create-react-app my-app --scripts-version=@skyscanner/backpack-react-scripts --template @skyscanner/backpack --use-npm
when I am running the above-mentioned command then I am getting the below error:
Creating a new React app in C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and @skyscanner/backpack-react-scripts with @skyscanner/cra-template-backpack...
npm ERR! code 1
npm ERR! path C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\TheForage\\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\\my-app\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@18.16.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
npm ERR! gyp verb find Python checking if "python" can be used
npm ERR! gyp verb find Python - executing "python" to get executable path
npm ERR! gyp verb find Python - executable path is "C:\Users\dhaval\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp verb find Python - executing "C:\Users\dhaval\AppData\Local\Programs\Python\Python311\python.exe" to get version
npm ERR! gyp verb find Python - version is "3.11.4"
npm ERR! gyp info find Python using Python version 3.11.4 found at "C:\Users\dhaval\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.16.0
npm ERR! gyp verb command install [ '18.16.0' ]
npm ERR! gyp verb install input version string "18.16.0"
npm ERR! gyp verb install installing version: 18.16.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 18.16.0
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb find VS msvs_version was set from command line or npm config
npm ERR! gyp verb find VS - looking for Visual Studio installed in "C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-sass\="
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp verb find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp verb find VS looking for Visual Studio 2015
npm ERR! gyp verb find VS - not found
npm ERR! gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio installed in "C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-sass\="
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm ERR! gyp ERR! stack at C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm ERR! gyp ERR! stack at C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:427:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\dhaval\\Desktop\\Coursera Learning\\TheForage\\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\\my-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme\my-app\node_modules\node-sass
npm ERR! gyp ERR! node -v v18.16.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dhaval\AppData\Local\npm-cache\_logs\2023-06-13T01_05_58_301Z-debug-0.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom @skyscanner/backpack-react-scripts @skyscanner/cra-template-backpack has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting my-app/ from C:\Users\dhaval\Desktop\Coursera Learning\TheForage\SkyScanner_FrontEnd_Software_Engineering_Virtual_Experience_Programme
Done.
also, apart from that I’ve cloned a Open Source Project (https://github.com/Bunlong/next-share) this one & when I am doing npm i
then I am getting below error:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: fork-ts-checker-webpack-plugin@6.5.3
npm WARN Found: eslint@8.42.0
npm WARN node_modules/fork-ts-checker-webpack-plugin/node_modules/eslint
npm WARN peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/eslint-utils@4.4.0
npm WARN node_modules/fork-ts-checker-webpack-plugin/node_modules/@eslint-community/eslint-utils
npm WARN @eslint-community/eslint-utils@"^4.2.0" from eslint@8.42.0
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional eslint@">= 6" from fork-ts-checker-webpack-plugin@6.5.3
npm WARN node_modules/fork-ts-checker-webpack-plugin
npm WARN fork-ts-checker-webpack-plugin@"^6.5.0" from react-dev-utils@12.0.1
npm WARN node_modules/react-dev-utils
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\Open_Source_Contribution\\next-share\\node_modules\\@jridgewell\\gen-mapping',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\dhaval\Desktop\Coursera Learning\Open_Source_Contribution\next-share\node_modules\@jridgewell\gen-mapping\node_modules\@jridgewell\sourcemap-codec\dist'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\Open_Source_Contribution\\next-share\\node_modules\\@jridgewell\\gen-mapping\\node_modules\\@jridgewell\\sourcemap-codec\\dist'
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\Open_Source_Contribution\\next-share\\node_modules\\workbox-build\\node_modules',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\dhaval\Desktop\Coursera Learning\Open_Source_Contribution\next-share\node_modules\workbox-build\node_modules'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\Open_Source_Contribution\\next-share\\node_modules\\workbox-build\\node_modules'
npm WARN cleanup }
npm WARN cleanup ],
npm WARN cleanup [
npm WARN cleanup 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\Open_Source_Contribution\\next-share\\node_modules',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\dhaval\Desktop\Coursera Learning\Open_Source_Contribution\next-share\node_modules\postcss-load-config\node_modules\yaml'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\Users\\dhaval\\Desktop\\Coursera Learning\\Open_Source_Contribution\\next-share\\node_modules\\postcss-load-config\\node_modules\\yaml'
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\dhaval\Desktop\Coursera Learning\Open_Source_Contribution\next-share\node_modules\iltorb
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./scripts/install.js || node-gyp rebuild
npm ERR! info install installing standalone, skipping download.
npm ERR! node:internal/modules/cjs/loader:1078
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module 'C:\Users\dhaval\node_modules\node-gyp\bin\node-gyp.js'
npm ERR! at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
npm ERR! at Module._load (node:internal/modules/cjs/loader:920:27)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR! at node:internal/main/run_main_module:23:47 {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: []
npm ERR! }
npm ERR!
npm ERR! Node.js v18.16.0
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dhaval\AppData\Local\npm-cache\_logs\2023-06-13T01_11_28_524Z-debug-0.log
Environment
- npm: 9.5.1
- Node.js: 18.16.0
- OS Name: Windows 11
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc
prefix = "C:\\Users\\dhaval\\AppData\\Roaming\\npm"
; "global" config from C:\Users\dhaval\AppData\Roaming\npm\etc\npmrc
; msvs_version = "2022" ; overridden by user
; "user" config from C:\Users\dhaval\.npmrc
//registry.npmjs.org/:_authToken = (protected)
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.16.0
; npm local prefix = C:\Users\dhaval\Desktop\Coursera Learning\Open_Source_Contribution\next-share
; npm version = 9.5.1
; cwd = C:\Users\dhaval\Desktop\Coursera Learning\Open_Source_Contribution\next-share
; HOME = C:\Users\dhaval
; Run `npm config ls -l` to show all defaults.
even though I tried to uninstall the Nodejs & re-installed the LTS Version 18.16.0, but still the issue persist. I tried using Command Line,
Command Line (Administrator)&
PowerShell` but got the same error only
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 51 (19 by maintainers)
@tonyzep966 You might also have a https://github.com/nodejs/node-gyp/labels/ffi-napi problem.
That works for me, thx!
To see all valid options try:
npm config list -l
The tool seems to prefer that configuration options use hyphens, not underscores. I believe that newer versions of npm dropped this configuration option.Can you please try running the commands in VS Command Prompt and defining the
VCINSTALLDIR
environment variable?