runbytech / ultron-ele

The world’s fastest LMS engine based on Gatsby -- Deliver knowledge with fun!
http://ultronele.com
MIT License
30 stars 9 forks source link

can't get it to work on gatsby-cli version 4.21.0 #3

Closed rhildred closed 2 years ago

rhildred commented 2 years ago

When I run gatsby new my-ultronele https://github.com/runbytech/ultron-ele I get node-gyp error 1 from msbuild while building sharp on windows. The demo on netlify still works.

I made a starter blog with gatsby new my-gatsby-project https://github.com/gatsbyjs/gatsby-starter-blog successfully.

This is the node-gyp error:

npm ERR! code 1
npm ERR! path C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\rhildred\AppData\Local\Temp\install-5a1f8122.cmd
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR!   VError.cpp
npm ERR!   VInterpolate.cpp
npm ERR!   VImage.cpp
npm ERR!   win_delay_load_hook.cc
npm ERR!      Creating library C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\Release\libvips-cpp.lib and object C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\Release\libvips-cpp.exp
npm ERR!   Generating code
npm ERR!   Previous IPDB not found, fall back to full compilation.
npm ERR!   All 943 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
npm ERR!   Finished generating code
npm ERR!   libvips-cpp.vcxproj -> C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\Release\\libvips-cpp.dll
npm ERR!   common.cc
npm ERR!   metadata.cc
npm ERR! C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\src\metadata.cc(34,20): warning C4834: discarding return value of function with 'nodiscard' attribute [C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\sharp.vcxproj]
npm ERR! C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\src\metadata.cc(190,20): warning C4834: discarding return value of function with 'nodiscard' attribute [C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\sharp.vcxproj]
npm ERR!   stats.cc
npm ERR! C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\src\stats.cc(35,20): warning C4834: discarding return value of function with 'nodiscard' attribute [C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\sharp.vcxproj]
npm ERR! C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\src\stats.cc(130,1): error C2661: 'v8::Object::Set': no overloaded function takes 2 arguments [C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\sharp.vcxproj]
npm ERR! C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\src\stats.cc(140,20): warning C4834: discarding return value of function with 'nodiscard' attribute [C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\sharp.vcxproj]
npm ERR! info sharp Using cached C:\Users\rhildred\AppData\Local\npm-cache\_libvips\libvips-8.7.4-win32-x64.tar.gz
npm ERR! info sharp Creating C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\Release
npm ERR! info sharp Copying DLLs from C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\vendor\lib to C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp\build\Release
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@18.7.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32630.194) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\rhildred\\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\\rhildred\\source\\projects\\aug23ultronelletake2\\node_modules\\sharp\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\rhildred\\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\\rhildred\\AppData\\Local\\node-gyp\\Cache\\18.7.0\\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\\rhildred\\AppData\\Local\\node-gyp\\Cache\\18.7.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\rhildred\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\rhildred\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\18.7.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\rhildred\\source\\projects\\aug23ultronelletake2\\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\\rhildred\\source\\projects\\aug23ultronelletake2\\node_modules\\sharp\\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\BuildTools\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\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\rhildred\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:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rhildred\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"        
npm ERR! gyp ERR! cwd C:\Users\rhildred\source\projects\aug23ultronelletake2\node_modules\sharp
npm ERR! gyp ERR! node -v v18.7.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:

 ERROR 

Command failed with exit code 1: npm install

  Error: Command failed with exit code 1: npm install

  - error.js:60 makeError
    [npm]/[gatsby-cli]/[execa]/lib/error.js:60:11

  - index.js:118 handlePromise
    [npm]/[gatsby-cli]/[execa]/index.js:118:26

  - task_queues:95 processTicksAndRejections
    node:internal/process/task_queues:95:5

  - init-starter.js:135 install
    [npm]/[gatsby-cli]/lib/init-starter.js:135:7

  - init-starter.js:202 clone
    [npm]/[gatsby-cli]/lib/init-starter.js:202:3

  - init-starter.js:343 initStarter
    [npm]/[gatsby-cli]/lib/init-starter.js:343:5

  - create-cli.js:458 
    [npm]/[gatsby-cli]/lib/create-cli.js:458:9
rhildred commented 2 years ago

I switched in to the project folder, deleted package-lock.json, and did npm install. Then I was able to finish. Now the front matter cover images are coming up as strings and I am getting the error:

There was an error in your GraphQL query:

      Field "cover" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
      "dummy content". Visit our docs to learn how you can define the schema for "undefined":
      https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: C:/Users/rhildred/source/projects/Aug23my-ultronele/src/pages/index.js

There was an error in your GraphQL query:

      Field "cover" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
      "dummy content". Visit our docs to learn how you can define the schema for "undefined":
      https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: C:/Users/rhildred/source/projects/Aug23my-ultronele/src/pages/index.js

There was an error in your GraphQL query:

      Field "cover" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
      "dummy content". Visit our docs to learn how you can define the schema for "undefined":
      https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: C:/Users/rhildred/source/projects/Aug23my-ultronele/src/templates/post.js

There was an error in your GraphQL query:

      Field "cover" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
      "dummy content". Visit our docs to learn how you can define the schema for "undefined":
      https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: C:/Users/rhildred/source/projects/Aug23my-ultronele/src/templates/category.js

There was an error in your GraphQL query:

      Field "cover" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
      "dummy content". Visit our docs to learn how you can define the schema for "undefined":
      https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: C:/Users/rhildred/source/projects/Aug23my-ultronele/src/templates/category.js

There was an error in your GraphQL query:

      Field "cover" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "cover". If you didn't expect "cover" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
      "dummy content". Visit our docs to learn how you can define the schema for "undefined":
      https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: C:/Users/rhildred/source/projects/Aug23my-ultronele/src/templates/tutorial.js
lwz7512 commented 2 years ago

hi @rhildred thanks for trying out this project, unfortunately this project is no longer being maintained....so, i recommend you looking for other better alternatives for your blog, meanwhile i will have a try on rebuiding this project. If i succeeded, i'll let you know.

lwz7512 commented 2 years ago

hi @rhildred :

I just rebuilt this project successfully in my Mac pc with this environment:

You may need to switch your local build tools into these version. for node version management, you could use nvm, for python version, you could use pyenv. uninstall the latest gatsby-cli and install v2.4.10 by:

npm i -g gatsby-cli@2.4.10

if you still have problems in building process, feel free to leave comments...

rhildred commented 2 years ago

You are right:

  1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash to install nvm
  2. nvm install 11.0.0 to get the right version of node
  3. npm install --vs2015 --global windows-build-tools so that I could build sharp on windows
  4. npm i -g gatsby-cli@2.4.10 to get the same version of gatsby-cli.

That was that. Thanks so much for your help.

lwz7512 commented 2 years ago

Thank you very much for your windows solution! Good job! @rhildred