Error installing dependencies for one-click-hugo-cms

Hi Netlify support!

Netlify site name: cozy-blancmange-762924.netlify.app/

After cloning the site locally, I experienced build errors when running npm install. Below is the error output. I can’t include the complete output because it contains links to registry.npmjs and your forum post processor precludes more then 2 links for new users. In addition to helping me with my error, can you also change settings so new users can post errors with more then 2 links?

Thanks!
Steve

11111 error code 1
11112 error path C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-sass
11113 error command failed
11114 error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
11115 error Building: C:\Program Files\nodejs\node.exe C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
11116 error gyp info it worked if it ends with ok
11116 error gyp verb cli [
11116 error gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
11116 error gyp verb cli   'C:\\local-work\\Netlify-Sites\\one-click-hugo-cms\\node_modules\\node-gyp\\bin\\node-gyp.js',
11116 error gyp verb cli   'rebuild',
11116 error gyp verb cli   '--verbose',
11116 error gyp verb cli   '--libsass_ext=',
11116 error gyp verb cli   '--libsass_cflags=',
11116 error gyp verb cli   '--libsass_ldflags=',
11116 error gyp verb cli   '--libsass_library='
11116 error gyp verb cli ]
11116 error gyp info using node-gyp@3.8.0
11116 error gyp info using node@16.16.0 | win32 | x64
11116 error gyp verb command rebuild []
11116 error gyp verb command clean []
11116 error gyp verb clean removing "build" directory
11116 error gyp verb command configure []
11116 error gyp verb check python checking for Python executable "python2" in the PATH
11116 error gyp verb `which` failed Error: not found: python2
11116 error gyp verb `which` failed     at getNotFoundError (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:13:12)
11116 error gyp verb `which` failed     at F (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:68:19)
11116 error gyp verb `which` failed     at E (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:80:29)
11116 error gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:89:16
11116 error gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\index.js:42:5
11116 error gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\windows.js:36:5
11116 error gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
11116 error gyp verb `which` failed  python2 Error: not found: python2
11116 error gyp verb `which` failed     at getNotFoundError (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:13:12)
11116 error gyp verb `which` failed     at F (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:68:19)
11116 error gyp verb `which` failed     at E (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:80:29)
11116 error gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:89:16
11116 error gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\index.js:42:5
11116 error gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\windows.js:36:5
11116 error gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
11116 error gyp verb `which` failed   code: 'ENOENT'
11116 error gyp verb `which` failed }
11116 error gyp verb check python checking for Python executable "python" in the PATH
11116 error gyp verb `which` succeeded python C:\Python39\python.EXE
11116 error gyp ERR! configure error 
11116 error gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
11116 error gyp ERR! stack   File "<string>", line 1
11116 error gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
11116 error gyp ERR! stack                       ^
11116 error gyp ERR! stack SyntaxError: invalid syntax
11116 error gyp ERR! stack 
11116 error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:398:12)
11116 error gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
11116 error gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
11116 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
11116 error gyp ERR! System Windows_NT 10.0.19044
11116 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\local-work\\Netlify-Sites\\one-click-hugo-cms\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
11116 error gyp ERR! cwd C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-sass
11116 error gyp ERR! node -v v16.16.0
11116 error gyp ERR! node-gyp -v v3.8.0
11116 error gyp ERR! not ok 
11116 error Build failed with error code: 1
11117 verbose exit 1
11118 timing npm Completed in 83713ms
11119 verbose unfinished npm timer reify 1665613220051
11120 verbose unfinished npm timer reify:build 1665613293177
11121 verbose unfinished npm timer build 1665613293183
11122 verbose unfinished npm timer build:deps 1665613293183
11123 verbose unfinished npm timer build:run:postinstall 1665613294359
11124 verbose unfinished npm timer build:run:postinstall:node_modules/node-sass 1665613294420
11125 verbose code 1

@steveopixie go ahead and post additional context in a reply to your post so we can see more. The ability to post more than one link here will be unlocked for you pretty quickly if you continue to be active here.

Not sure if that template you’re deploying is the most up to date way to get a Hugo CMS on Netlify but I wanted to make sure you saw this page from the Netlify docs which describes what seems to be a cleaner integration. I’ve been wrong before though.

https://docs.netlify.com/integrations/frameworks/hugo

I did check your site though and looks sharp. Are you still having the issue?

Hi,

I resolved the issue by running npm start --location=global, but I have another question.

Using the instructions in the README.md file, I attempted to start the site using npm start, but I got this output:

npm WARN config global --global, --local are deprecated. Use --location=global instead.

> victor-hugo@1.0.0 start
> run-p start:**

‘run-p’ is not recognized as an internal or external command,
operable program or batch file.

C:\local-work\Netlify-Sites\one-click-hugo-cms>

I then looked at the package.json file and found “start:hugo”: “hugo -d …/dist -s site -vw”,

so I ran npm run-script start:hugo

Usually when you run a start script it gives you the host and port, but I didn’t see those.

Can you tell me what command I should use?

I suggest that the README.md file be updated. :slight_smile:

Thanks

Oh, sorry. I meant I used npm install --location=global to do the installation and it succeeded.

1 Like

It means exactly what it says. The old flags --global and --local are deprecated in favour of --location=global or --location=local. This is an NPM thing

This is what I see running npm start

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:3000/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.137:3000/
<i> [webpack-dev-server] On Your Network (IPv6): http://[fe80::1]:3000/

Which shows where things are running. And it does say in the README.md under Local Development

Local Development

Clone this repository, and run yarn or npm install from the new folder to install all required dependencies.

Then start the development server with yarn start or npm start.

Hello support.

Thanks for great support on this issue. I appreciate your help.

I just recloned the repo and ran npm install --legacy-peer-deps and got the output below. Is the an npm thing, or a hugo thing, or something specific to the template that Netlify maintains? If you are running the same command against the same cloned repo, shouldn’t we be getting similar results?

Thank you very much.

Here is the output:

npm WARN deprecated @types/vfile-message@2.0.0: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated mini-create-react-context@0.4.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated memoize-one@4.1.0: New custom equality api does not play well with all equality helpers. Please use v5.x
npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported
npm WARN deprecated redux-devtools-extension@2.13.9: Package moved to @redux-devtools/extension.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path C:\local-work\Netlify-Sites\one-click-hugo-cms\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:\local-work\Netlify-Sites\one-click-hugo-cms\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:\\local-work\\Netlify-Sites\\one-click-hugo-cms\\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@3.8.0
npm ERR! gyp info using node@16.18.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 check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python310\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python310\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:402:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:458:11)
npm ERR! gyp ERR! stack     at Socket.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:301:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\local-work\\Netlify-Sites\\one-click-hugo-cms\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\local-work\Netlify-Sites\one-click-hugo-cms\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.18.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

I am running NodeJS v16.16.0 (as per your OP @steveopixie) and have no such issues. It is possible this is a Windows-specific issue (I use macOS.)

Could you try

The issue is due to node-sass (this is in the original post, I just missed it.) When using NodeJS 16, node-sass 6.0+ is required. The version npm is trying to install is earlier and thus incompatible. Thus is tries to build it and fails.

This reason I didn’t see the error is node-sass wasn’t installed when I ran npm install. Looking through the package-lock.json it is a peer dependency of sass-loader and marked as optional, not a direct dependency of the project. You could try running npm install --omit peer or npm install --omit optional

Another option you might try is adding node-sass as a dependency in the package.json after cloning, e.g.

"node-sass": "^6.0.1"

and see if this works (this version of the package is compatible with NodeJS 16.)

Hi @coelmay, thank you so much for your detailed investigation!

I will give this a try.

Steve