Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

node.js - How can I solve error gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config?

I want to run this project : https://github.com/adonis-china/adonis-adminify

When I run npm install, there exist error :

> [email protected] install C:laragonwwwadonis-admin
ode_modulessqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! gypfind VS
 gyp ERR!ERR!  find VSfind VS
 msvs_version not set from command line or npm config
gypgyp  ERR!ERR!  find VSfind VS msvs_version not set from command line or npm config
 VCINSTALLDIR not set, not running in VS Command Prompt
gyp gypERR! ERR!  find VSfind VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp checking VS2019 (16.2.29230.47) found at:
 gypERR!  find VSERR! checking VS2019 (16.2.29230.47) found at:
gyp  find VS "C:Program Files (x86)Microsoft Visual Studio2019Professional"
ERR!gyp find VS ERR! "C:Program Files (x86)Microsoft Visual Studio2019Professional"
 gypfind VS ERR! - "Visual Studio C++ core features" missing
gyp  ERR!find VS  - "Visual Studio C++ core features" missing
find VSgyp could not find a version of Visual Studio 2017 or newer to use
 gypERR!  ERR!find VS  could not find a version of Visual Studio 2017 or newer to use
find VS looking for Visual Studio 2015
gyp gyp ERR!ERR!  find VSfind VS looking for Visual Studio 2015
 - not found
gyp gyp ERR!ERR!  find VSfind VS - not found
 not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR!gyp  ERR!find VS find VS not looking for VS2013 as it is only supported up to Node.js 8

gyp gypERR!  ERR!find VS
 gypfind VS  **************************************************************
gypERR!  ERR!find VS find VS **************************************************************
 You need to install the latest version of Visual Studio
gypgyp ERR!  ERR!find VS find VS You need to install the latest version of Visual Studio
 including the "Desktop development with C++" workload.
gypgyp  ERR!ERR! find VS find VS including the "Desktop development with C++" workload.
 For more information consult the documentation at:
gyp ERR!gyp find VS  For more information consult the documentation at:
ERR!gyp  ERR! find VSfind VS https://github.com/nodejs/node-gyp#on-windows
 https://github.com/nodejs/node-gyp#on-windows
gyp gyp ERR!ERR! find VS  **************************************************************
find VSgyp **************************************************************
 gypERR! find VS
ERR! find VS
gyp gypERR!  ERR!configure error
 configure errorgyp
 ERR! stackgyp Error: Could not find any Visual Studio installation to use
 gypERR!  stackERR! Error: Could not find any Visual Studio installation to use
 stackgyp      at VisualStudioFinder.fail (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:121:47)
ERR!gyp stack      at VisualStudioFinder.fail (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:121:47)
ERR! gypstack      at findVisualStudio2013 (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:74:16)
gypERR!  ERR!stack      at findVisualStudio2013 (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:74:16)
stack     at VisualStudioFinder.findVisualStudio2013 (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:344:14)
gypgyp ERR! stack     at findVisualStudio2015 (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:70:14)
 gypERR!  ERR! stackstack     at regSearchKeys (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:365:16)
     at VisualStudioFinder.findVisualStudio2013 (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:344:14)
gyp gypERR!  ERR!stack stack     at regGetValue (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibutil.js:54:7)
     at findVisualStudio2015 (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:70:14)
gypgyp  ERR!ERR!  stackstack     at C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibutil.js:33:16
gyp     at regSearchKeys (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibfind-visualstudio.js:365:16)
 gyp ERR! ERR!stack     at ChildProcess.exithandler (child_process.js:301:5)
 gypstack      at regGetValue (C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibutil.js:54:7)
ERR! gypstack     at ChildProcess.emit (events.js:182:13)
 gypERR! ERR!  stack     at C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibutil.js:33:16
stack     at maybeClose (internal/child_process.js:962:16)
gyp gypERR! ERR!  System Windows_NT 10.0.17134
stackgyp     at ChildProcess.exithandler (child_process.js:301:5)
 ERR!gyp  commandERR! "C:\Program Files\nodejs\node.exe" "C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64" "--python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe"
 gypstack     at ChildProcess.emit (events.js:182:13)
 gypERR!  ERR!cwd C:laragonwwwadonis-admin
ode_modulessqlite3
 gypstack ERR!     at maybeClose (internal/child_process.js:962:16)
 node -v v10.15.0
gypgyp  ERR!ERR!  Systemnode-gyp -v Windows_NT 10.0.17134
 v5.0.3
gypgyp  ERR!ERR! command  "C:\Program Files\nodejs\node.exe" "C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64" "--python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe"
not okgyp
 ERR! cwd C:laragonwwwadonis-admin
ode_modulessqlite3
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:Program Files
odejs
ode.exe C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gypin
ode-gyp.js configure --fallback-to-build --module=C:laragonwwwadonis-admin
ode_modulessqlite3libinding
ode-v64-win32-x64
ode_sqlite3.node --module_name=node_sqlite3 --module_path=C:laragonwwwadonis-admin
ode_modulessqlite3libinding
ode-v64-win32-x64 --python=C:UsersChelsea.windows-build-toolspython27python.exe' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:laragonwwwadonis-admin
ode_modulessqlite3
ode_modules
ode-pre-gyplibutilcompile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\laragon\www\adonis-admin\node_modules\sqlite3\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:laragonwwwadonis-admin
ode_modulessqlite3
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'C:Program Files
odejs
ode.exe C:UsersChelseaAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gypin
ode-gyp.js configure --fallback-to-build --module=C:laragonwwwadonis-admin
ode_modulessqlite3libinding
ode-v64-win32-x64
ode_sqlite3.node --module_name=node_sqlite3 --module_path=C:laragonwwwadonis-admin
ode_modulessqlite3libinding
ode-v64-win32-x64 --python=C:UsersChelsea.windows-build-toolspython27python.exe' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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:UsersChelseaAppDataRoaming
pm-cache\_logs2019-09-10T22_53_41_072Z-debug.log

How can I solve the error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

TL;DR

Use the Visual Studio Installer to get the Desktop development with C++ workload in one of the Visual Studio versions you have installed in your machine:

VS workloads

Reason/Details

Reading through the log, the main error is due to this:

msvs_version not set from command line or npm config

After this one you find a few of these:

"Visual Studio C++ core features" missing

And later:

You need to install the latest version of Visual Studio including the "Desktop development with C++" workload.

For more information consult the documentation at:

VS https://github.com/nodejs/node-gyp#on-windows

Finally:

Could not find any Visual Studio installation to use

So to solve the problem, you just need to get "Desktop development with C++" workload.

If you have a Visual Studio version installed

  1. open Visual Studio Installer (Win + search for it)
  2. on the list displayed with all Visual Studio Installations you have in your PC, press the Modify button of one of them (preferably the latest version)
  3. on the Workloads grid/list select the checkbox with Desktop development with C++
  4. Press one of the Install buttons

gyp will then find that version and use it:

gyp info find Python using Python version 3.8.1 found at "C:UsersUSERAppDataLocalProgramsPythonPython38-32python.exe"

gyp info find VS using VS2019 (16.4.29709.97) found at:

gyp info find VS "C:Program Files (x86)Microsoft Visual Studio2019

With NO Visual Studio installed

Disclaimer: I did not test any of these solutions.

Alternative 1

As Hamid Jolany's answer suggests, on an admin shell, simply install the build tools package globally (node-gyp README):

npm i -g windows-build-tools

Alternative 2

Ragavan's idea/answer for avoiding installing Visual Studio has some logic:

  1. verify if you have VS build tools by running npm config get msvs_version (if you have, skip to step 4 and attempt setting the environment variables)
  2. if not installed, get the VS build tools latest version exe and install it (Ragavan's idea was with or Microsoft Build Tools 2015)
  3. run npm config set msvs_version 2019 --global (or npm config set msvs_version 2015 --global according to Ragavan's idea)
  4. (optional? I have VS installed and do not have this variable declared) set the VCTargetsPathenvironment variable (Win + search for var) to the appropriate path (e.g. C:Program Files (x86)MSBuildMicrosoftPortablev5.0) or through Run as Admin terminal, as in Ragavan's idea with the 2015 Build Tools:
  • set VCTargetsPath=C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140
  • or in Powershell: $env:VCTargetsPath=C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140

Side notes:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...