dhirajbasukala / basukala.me

A personal site.
MIT License
0 stars 0 forks source link

Error when installing dependencies #12

Closed SeifESlimene closed 1 year ago

SeifESlimene commented 4 years ago

When i did npm install command in terminal

$ npm install
npm ERR! code 1
npm ERR! path C:\Users\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "(node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)"
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! 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\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp\build\binding.sln]
npm ERR! 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\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp\build\binding.sln]
npm ERR! info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-win32-x64.tar.gz
npm ERR! info sharp Creating C:\Users\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp\build\Release
npm ERR! info sharp Copying DLLs from C:\Users\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp\vendor\lib to C:\Users\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp\build\Release
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@15.0.1 | win32 | x64
npm ERR! gyp http GET https://nodejs.org/download/release/v15.0.1/node-v15.0.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v15.0.1/node-v15.0.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v15.0.1/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v15.0.1/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v15.0.1/win-x64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v15.0.1/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v15.0.1/win-x64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v15.0.1/SHASUMS256.txt
npm ERR! gyp info spawn C:\Python27\python.EXE
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\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   '-G',
npm ERR! gyp info spawn args   'msvs_version=auto',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\node_modules\\sharp\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Seif Eddine Slimene\\.node-gyp\\15.0.1\\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\\Seif Eddine Slimene\\.node-gyp\\15.0.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Seif Eddine Slimene\\.node-gyp\\15.0.1\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\node_modules\\sharp',
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\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\node_modules\\sharp\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCLinkerTool/ImageHasSafeExceptionHandlers
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
npm ERR! Warning: unrecognized setting VCLinkerTool/ImageHasSafeExceptionHandlers
npm ERR! gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe' failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:327:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Seif Eddine Slimene\\Documents\\Projects\\basukala.me\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Seif Eddine Slimene\Documents\Projects\basukala.me\node_modules\sharp
npm ERR! gyp ERR! node -v v15.0.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Seif Eddine Slimene\AppData\Local\npm-cache\_logs\2020-11-12T03_00_52_679Z-debug.log
dhirajbasukala commented 4 years ago

I have not tried the installation with latest node 15 version. It may be due that. Can you delete package-lock.json and node-modules folder, run npm update and install again.

dhirajbasukala commented 4 years ago

I was able to test it now. I switched back my node version to version 10(v10.13.0 to be specific). I tried starting the app(npm start). It gave back the sharp module error. Then, I removed the node_modules folder. Ran install (npm install) again. This time it worked. I switched to node version 11. I tried running the app. It gave the error below:


❯ nvm use 11
Now using node v11.0.0 (npm v6.4.1)
❯ node -v
v11.0.0
❯ npm start

> gatsby-starter-hello-world@0.1.0 start /Volumes/Work files/dev/github/basukala.me
> npm run develop

> gatsby-starter-hello-world@0.1.0 develop /Volumes/Work files/dev/github/basukala.me
> gatsby develop

success open and validate gatsby-configs - 0.019s
success load plugins - 0.382s
success onPreInit - 0.021s
success initialize cache - 0.005s
success copy gatsby files - 0.056s
success onPreBootstrap - 0.014s
success createSchemaCustomization - 0.001s
success Checking for changed pages - 0.000s
success source and transform nodes - 0.030s
success building schema - 0.194s
info Total nodes: 24, SitePage nodes: 1 (use --verbose for breakdown)
success createPages - 0.001s
success Checking for changed pages - 0.000s
success createPagesStatefully - 0.073s
success update schema - 0.023s
success write out redirect data - 0.001s
success Build manifest and related icons - 0.001s
success onPostBootstrap - 0.003s
info bootstrap finished - 3.272s
success onPreExtractQueries - 0.000s
success extract queries from components - 0.075s
success write out requires - 0.005s
success run page queries - 0.021s - 2/2 96.47/s
warning ESLintError:
/Volumes/Work files/dev/github/basukala.me/src/pages/index.js
  20:85   warning  Using target="_blank" without rel="noreferrer" is a security risk: see https://html.spec.whatwg.org/multipage/links.html#link-type-noopener  react/jsx-no-target-blank
  20:156  warning  Using target="_blank" without rel="noreferrer" is a security risk: see https://html.spec.whatwg.org/multipage/links.html#link-type-noopener  react/jsx-no-target-blank

✖ 2 problems (0 errors, 2 warnings)

error Generating development JavaScript bundle failed

Missing binding /Volumes/Work files/dev/github/basukala.me/node_modules/node-sass/vendor/darwin-x64-67/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 11.x

Found bindings for the following environments:
  - OS X 64-bit with Node.js 10.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
failed Building development bundle - 3.733s

I needed to rebuild node-sass though( npm rebuild node-sass). I did that and it worked. The app ran at port 8000. I gradually switched to node version 12, 13, and, 14. Each of them complained about node-sass binary not found. Each time I installed them and it worked afterwards. I finally switched to node version 15. And the error your reported, that i faced blindly appeared again. I checked nodejs website and found it was the latest version and not LTS. It contained the breaking change that do not support node sass. Please make sure you're using LTS version for stability. I'm glad if it help you( @SeifESlimene)