I get an error when trying to install strapi - strapi

When trying to install strapi with npx create-strapi-app#latest my-project
, an error appears. Everything used to work fine, now it doesn't want to install. In general, I can not solve the problem anywhere. Also tried reinstalling Python, node, sqlite3, gyp and nothing helped. Here is the error code
Creating a new Strapi application at D:\next\traversy\my-project.
Creating files.
error D:\next\traversy\my-project\node_modules\better-sqlite3: Command failed.
Exit code: 1
Command: prebuild-install || npm run build-release
Arguments:
Directory: D:\next\traversy\my-project\node_modules\better-sqlite3
Output:
prebuild-install warn install No prebuilt binaries found (target=18.12.1 runtime=node arch=x64 libc= platform=win32)
> better-sqlite3#7.4.6 build-release
> node-gyp rebuild --release
gyp info it worked if it ends with ok
gyp info using node-gyp#9.1.0
gyp info using node#18.12.1 | win32 | x64
gyp info find Python using Python version 3.11.0 found at "C:\Users\zayts\AppData\Local\Programs\Python\Python311\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack at C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:364:14)
gyp ERR! stack at C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack at C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:385:16
gyp ERR! stack at C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Users\zayts\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (node:child_process:420:5)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\zayts\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd D:\next\traversy\my-project\node_modules\better-sqlite3
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok
Keep trying!
Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.```

Check the most suited node version from strapi doc.
https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/installation/cli.html#preparing-the-installation
in my case, I simply downgraded my node version from 18 to 16, and the strapi installed everything without a single error or warning.

Not sure why, but the error states this:
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
I’m guessing you are missing some node js dependencies, you prolly want to re download node and check the Install Prerequisites check box https://nodejs.org/en/download/
The error probably points to some VC_redist

Related

VS Code "gyp ERR! find VS"

althogh I've searched to get this error solved I couldn't find any proper solution.
Visual Studio 2019 with complete C++ developer tools is installed as well as Python.
Anyhow I get this error when I install bcryptjs in VSCode:
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at findVisualStudio2013 (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at findVisualStudio2015 (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gyp ERR! stack at regSearchKeys (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16)
gyp ERR! stack at regGetValue (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
gyp ERR! stack at C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:301:5)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\BOSS\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\BOSS\Coding\PROJECTS\UDEMY\NODE.JS BOOTCAMP 2020\natours\node_modules\node-pty
gyp ERR! node -v v10.22.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN natours#1.0.0 No description
npm WARN natours#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty#0.9.0 (node_modules\node-pty):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty#0.9.0 install: `node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
Does anybody know what could be done to get rid of that error?
I've set npm config set msvs_version 2019 --global, but I still get VCINSTALLDIR not set, not running in VS Command Prompt and could not use PowerShell to find Visual Studio 2017 or newer
Btw, bcryptjs itself is getting installed but i think without some extras?
When I use yarn the whole compilation process works fine, so I think it's an annoying configuration error that I can't find.
Is there a manual way to set the VS directory?
I've tryied this solution https://stackoverflow.com/a/59882818/13609359 but with no success.
Many thanks in advance
Slevin
Well, after struggling around for more than two hours I came up with that solution:
npm install --global --production windows-build-tools
No easy way to find out that you need to install an extra package to get the compilation done (yarn gets it done out of the box as it should be).
Hopefully this solution can help others too, as it seems to be a huge problem installing packages that have a compiling process involved.
In my case npm install --global --production windows-build-tools resulted in an infinite loop as i already had visual studio installed.
So i went to my visual studio installer and from the modified option added the Desktop development with C++ (It was not added before). After successful installation all worked fine.
I previously had python installed and was using Visual Studio 2019 Community edition

I can not do yarn add because node-sass fails

I have a problem with yarn add && yard build.
Especially node-sass
Whenever I'm trying to run node-sass it is giving me this error
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/user/all001/app/themes/alliance/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/home/user/.nvm/versions/node/v14.4.0/bin/node" "/home/user/all001/app/themes/alliance/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/user/all001/app/themes/alliance/node_modules/node-sass
gyp ERR! node -v v14.4.0
gyp ERR! node-gyp -v v3.8.0
I really don't know how to fix this. Any suggestions, please?
I encountered the same error message when performing npm install node-sass. The only solution for me at the moment is to choose an older node version. Both v14 and v12 did not work, so I went back to v10. Luckily I had Node installed using nvm. You can run nvm install v10.22.1, for example. Use nvm ls-remote to see the available versions.
One difference, however, is that I tried to execute it on a Mac (System Darwin 19.6.0)

python error on npm package install Windows

On Windows, When I try to install wdio, I have a python error :
but python is installed and in the path.
the PYTHON variable is set to "C:\Program Files\Python36\python.exe", which is a correct path.
I don't know where the error is coming from, since it says it can find the executable, bit show the right path to the executable.
PS C:\Users\admin> npm install wdio
> fibers#1.0.15 install C:\Users\admin\node_modules\fibers
> node build.js || nodejs build.js
C:\Users\admin\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "" rebuild --release )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\python.exe", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
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" "--release"
gyp ERR! cwd C:\Users\admin\node_modules\fibers
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\admin\package.json'
You need to install Python 2.7 since node-gyp is not compatible with Python 3.x. See e.g. https://github.com/nodejs/node-gyp#on-windows
I had to reinstall node when I had similar issue ( this just updated to the current stable) Although before that I had updated every other thing while trying a solution including python for windows and node-gyp (npm install -g node-gyp). The node js update finally did it

installing d3 using npm causes contextify errors

Getting some mystifying contextify errors (but other installs seem to go fine.)
npm install d3
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install
Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
[C:\Users\dinesh\m3\node_modules\d3\node_modules\jsdom\node_modules\contextify\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\dinesh\m3\node_modules\d3\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! contextify#0.1.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
You've probably moved on at this point, but for future googlers:
Upgrade to D3.js v3.5.4+
jsdom is a dependency of d3, and jsdom requires contextify, which uses native modules (node-gyp). Native modules are hard to build on some platforms, so d3 made jsdom a development dependency (not installed by default) as of v3.5.4.
Related: D3.js commit and D3.js issue.

strongloop fails to install on Windows Server 2012 R2

Experimenting with strongloop.
node version is v0.10.31
visual studio 2013 installed.
npm install fails.
this path look suspicious:
node "c:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
console:
$ npm install -g strongloop
/
> node-syslog#1.1.7 install C:\Users\Bruce\AppData\Roaming\npm\node_modules\strongloop\node_modules\strong-supervisor\node_modules\node-syslog
> node-gyp rebuild
|
C:\Users\Bruce\AppData\Roaming\npm\node_modules\strongloop\node_modules\strong-supervisor\node_modules\node-syslog>
node "c:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
syslog.cc
c:\users\bruce\appdata\roaming\npm\node_modules\strongloop\node_modules\strong-supervisor\node_modules\node-syslog\node-syslog.h(8): fatal error C1083: Cannot open include file: 'syslog.h': No such file or directory [C:\Users\Bruce\AppData\Roaming\npm\node_modules\strongloop\node_modules\strong-supervisor\node_modules\node-syslog\build\syslog.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "c:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Bruce\AppData\Roaming\npm\node_modules\strongloop\node_modules\strong-supervisor\node_modules\node-syslog
gyp ERR! node -v v0.10.31
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
node-syslog is an optional dependency, npm prints errors when it fails to build it, and then continues to install strongloop. Or, that is what npm is supposed to do, and does usually.
Its impossible to know from above whether strongloop actually installed correctly or not.
As for the "suspicious" path, that is npm printing out that it is calling its own internal copy of node-gyp. No idea why it uses the .. and all, you could ask them, but its not a problem.

Resources