Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and Deploy fails #1125

Open
Al3nMicL opened this issue Mar 29, 2023 · 8 comments
Open

Build and Deploy fails #1125

Al3nMicL opened this issue Mar 29, 2023 · 8 comments

Comments

@Al3nMicL
Copy link

Al3nMicL commented Mar 29, 2023

Describe the bug
The build and deploy step fails when running the ci: add Azure Static Web Apps workflow file. From the ci logs in my repo, it appears to fail when trying to call python2. Looks like the Docker image Azure is trying to run it on does not have it?

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Azure Static Web Apps training on Microsoft Learn.
  2. Progress to Unit 4 of 5.
  3. Complete up to step 10.
  4. See deploy build error

Expected behavior
For it to deploy.

Screenshots
n/a

Device info (if applicable):

  • OS: n/a
  • Browser: n/a
  • VS Code Version 1.76.2

Additional context
I tried to run it again using github actions online (to make sure it was not my editor) and it still failed.

@blowsie
Copy link

blowsie commented Mar 29, 2023

@Al3nMicL
Copy link
Author

You have some npm install issues https://github.com/Al3nMicL/my-static-web-app/actions/runs/4549391353/jobs/8021576375#step:4:60

Thanks, but I doubt it is the lock file. I've removed it and will try running the tutorial again. I really think that it is related to Python 2 not being found. I saw a similar issue from the MS Docs repo that also mentions a problem with Python 2. I suspect this made it into this version as well.

@Al3nMicL
Copy link
Author

Al3nMicL commented Apr 3, 2023

I ran it again and this time forked the initial commit to a new test branch with no modifications made. It encountered the same issues as before in the Build and Deploy job. I suppose this means that since the tutorial was written, it now no longer works.

@blowsie
Copy link

blowsie commented Apr 4, 2023

You still have npm install issues. You can build separately from the azure action if you want

@jpalo
Copy link

jpalo commented Aug 23, 2023

The logs OP provided are no longer available, but getting error when building my STA as well. Any new input on this issue? I'm trying to move to using Node 18 from Node 14, as it is a requirement by Gatsby, but am now stuck with this issue.

EDIT: Oh, looks like I've already filed an issue about this, but no response in 5 months ❤️ #1118

npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/node-sass
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c node scripts/build.js
npm ERR! npm ERR! Building: /opt/nodejs/18.16.1/bin/node /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp verb cli [
npm ERR! npm ERR! gyp verb cli   '/opt/nodejs/18.16.1/bin/node',
npm ERR! npm ERR! gyp verb cli   '/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! npm ERR! gyp verb cli   'rebuild',
npm ERR! npm ERR! gyp verb cli   '--verbose',
npm ERR! npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! npm ERR! gyp verb cli   '--libsass_library='
npm ERR! npm ERR! gyp verb cli ]
npm ERR! npm ERR! gyp info using node-gyp@3.8.0
npm ERR! npm ERR! gyp info using node@18.16.1 | linux | x64
npm ERR! npm ERR! gyp verb command rebuild []
npm ERR! npm ERR! gyp verb command clean []
npm ERR! npm ERR! gyp verb clean removing "build" directory
npm ERR! npm ERR! gyp verb command configure []
npm ERR! npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! npm ERR! gyp verb `which` failed     at getNotFoundError (/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:13:12)
npm ERR! npm ERR! gyp verb `which` failed     at F (/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:68:19)
npm ERR! npm ERR! gyp verb `which` failed     at E (/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:80:29)
npm ERR! npm ERR! gyp verb `which` failed     at /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:89:16
npm ERR! npm ERR! gyp verb `which` failed     at /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/isexe/index.js:42:5
npm ERR! npm ERR! gyp verb `which` failed     at /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/isexe/mode.js:8:5
npm ERR! npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:208:21)
npm ERR! npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! npm ERR! gyp verb `which` failed     at getNotFoundError (/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:13:12)
npm ERR! npm ERR! gyp verb `which` failed     at F (/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:68:19)
npm ERR! npm ERR! gyp verb `which` failed     at E (/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:80:29)
npm ERR! npm ERR! gyp verb `which` failed     at /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/which/which.js:89:16
npm ERR! npm ERR! gyp verb `which` failed     at /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/isexe/index.js:42:5
npm ERR! npm ERR! gyp verb `which` failed     at /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/isexe/mode.js:8:5
npm ERR! npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:208:21) {
npm ERR! npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! npm ERR! gyp verb `which` failed }
npm ERR! npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! npm ERR! gyp verb `which` succeeded python /opt/python/latest/bin/python
npm ERR! npm ERR! gyp ERR! configure error 
npm ERR! npm ERR! gyp ERR! stack Error: Command failed: /opt/python/latest/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! npm ERR! gyp ERR! stack                       ^
npm ERR! npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! npm ERR! gyp ERR! stack 
npm ERR! npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:419:12)
npm ERR! npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
npm ERR! npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! npm ERR! gyp ERR! System Linux 5.15.0-1041-azure
npm ERR! npm ERR! gyp ERR! command "/opt/nodejs/18.16.1/bin/node" "/github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! npm ERR! gyp ERR! cwd /github/home/.npm/_cacache/tmp/git-cloneDxsa4p/node_modules/node-sass
npm ERR! npm ERR! gyp ERR! node -v v18.16.1
npm ERR! npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! npm ERR! gyp ERR! not ok 
npm ERR! npm ERR! Build failed with error code: 1
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /github/home/.npm/_logs/2023-08-23T08_37_20_172Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2023-08-23T08_37_09_391Z-debug-0.log

@Al3nMicL
Copy link
Author

@jpalo I almost forgot about this issue. Thanks for commenting. Yeah, the last time I researched this I found some StackOverflow post that mentioned the build error could be due to a dependency chain issue caused by older packages from Node that are no longer available inside the current Linux container images in Azure (which causes the build to fail).

Your best bet is to see if you could download an Azure endorsed Linux container image from Docker hub and build your code locally. Find and fix any dependency issues if the build fails by updating your package.json accordingly. Then update your remote repo and try again. If it still fails, you may have to research how to use an older community gallery image and try building your code against that. Try Ubuntu 16.04-LTS and see if Gatsby will work on it (and hope the dependency chain is still intact).

@jpalo
Copy link

jpalo commented Sep 1, 2023

Hmm, but it seems to be a python2 requiremend from node-gyp.

@smita-debata
Copy link

Hi,
I am building a angular application in azure static web app and the build is getting failed. Can anyone help me on this.How to fix it.
Running 'npm install'...

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @fortawesome/angular-fontawesome@0.14.0
npm ERR! Found: @angular/core@16.2.12
npm ERR! node_modules/@angular/core
npm ERR! @angular/core@"^16.2.0" from the root project
npm ERR! peer @angular/core@"16.2.12" from @angular/animations@16.2.12
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"^16.2.0" from the root project
npm ERR! peer @angular/animations@"^16.0.0 || ^17.0.0" from @angular/material@16.2.12
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"^16.2.8" from the root project
npm ERR! 2 more (@angular/platform-browser, ngx-bootstrap)
npm ERR! 12 more (@angular/cdk, @angular/common, @angular/compiler, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"^17.0.0" from @fortawesome/angular-fontawesome@0.14.0
npm ERR! node_modules/@fortawesome/angular-fontawesome
npm ERR! @fortawesome/angular-fontawesome@"^0.14.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@17.1.0
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"^17.0.0" from @fortawesome/angular-fontawesome@0.14.0
npm ERR! node_modules/@fortawesome/angular-fontawesome
npm ERR! @fortawesome/angular-fontawesome@"^0.14.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /github/home/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /github/home/.npm/_logs/2024-01-19T15_58_08_867Z-debug-0.log

---End of Oryx build logs---
Oryx has failed to build the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants