I'm trying to Deploy a React App to a Static Web App in Azure, using my GitHub repository.
When I look in the actions in Git Hub and view the delopment run it fails.
This is the error that I see:
Running 'npm install --unsafe-perm'...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-typed#1.2.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR! peer react#"^18.0.0" from #testing-library/react#13.4.0
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^13.4.0" from the root project
npm ERR! 7 more (html-react-parser, react-dom, react-helmet, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.3.0" from react-typed#1.2.0
npm ERR! node_modules/react-typed
npm ERR! react-typed#"^1.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#16.14.0
npm ERR! node_modules/react
npm ERR! peer react#"^16.3.0" from react-typed#1.2.0
npm ERR! node_modules/react-typed
npm ERR! react-typed#"^1.2.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/2022-11-28T18_21_32_391Z-debug-0.log
---End of Oryx build logs---
Oryx has failed to build the solution.
Can anyone suggest why my build is failing and how to fix it?
This is what the yml work flow looks like:
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout#v3
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy#v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: "" # Api source code path - optional
output_location: "build" # Built app content directory - optional
###### End of Repository/Build Configurations ######
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy#v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: "close"
Check the below steps to deploy React app to Azure Static Web App
In file explorer create a folder with name reactstatic.
In VSCode, open the new terminal and run the below command to create a new react app.
npx create-react-app ./
Thanks #Christian Glessner for the Git Repo
In GitHub, create a new repository.
From VS Code, push the newly created app to GitHub
In Azure Portal, create a Static Web App using GitHubAccount with the below given values.
In GitHub,workflows folder will be created.
Check whether the build is success or not in GitHub -
https://github.com/Organization/YourAppName
Click on Actions => Build and Deploy Job
Now we can Open the Static Web App in Portal and access the Url.
Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
To fix the error, as mentioned in the error itself
run the below command
npm config set legacy-peer-deps true
npm i
To fix the error, as mentioned in the error itself
run the below command
npm config set legacy-peer-deps true
npm i
If you still face the issue, delete the node_modules folder ,package-json.lock file and run the above command again.
Related
I deployed a react app to Vercel that uses firebase. The build exits with status code 1.
I have installed firebase using: "npm install firebase" and it is running well on the local environment. What would be the possible error?
Creating an optimized production build...
Failed to compile.
./src/firebase.js
Cannot find module: 'firebase'. Make sure this package is installed.
You can install this package by running: npm install firebase.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! neozon#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appname#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2022-01-11T18_49_38_751Z-debug.log
Error: Command "npm run build" exited with 1
My guess is that the firebase package isn't installed on the server (unlike on your local environment), which most likely reads the dependencies from the package.json.
To add firebase to your package.json on your local system, run:
npm install firebase --save
After adding the home, predeploy and deploy values to package.JSON and running npm run deploy, the build folder was created successfully but the build was unable to be published.
I got this error
cloning into 'node_modules\gh-pages\.cache\github.com.okafohenry!birthday-list-keeper-react-app-.git'...
fatal: unable to access https://github.com.okafohenry/birthday-list-keeper-react-app-.git/': Could not resolve host: github.com.okafohenry
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! birthdaylistkeeper#1.0.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the birthdaylistkeeper#1.0.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I have been on this for a while now, how do I fix it?
The url seems to be wrong.
It should be https://github.com/okafohenry/birthday-list-keeper-react-app-.git/
I am trying to deploy my angularjs app into a docker container:
myapp/web/Dockerfile
FROM node:latest
RUN mkdir /myapp
ADD . /myapp
WORKDIR /myapp
RUN npm install -g phantomjs-prebuilt
RUN npm install -g grunt-cli
RUN npm install -g grunt
RUN npm install -g bower
RUN npm install
RUN bower install --allow-root
RUN npm run v2
EXPOSE 9000
CMD ["grunt", "serve"]
myapp/docker-compose.yml
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
web:
build: ./web
image: myapp/web
environment:
- VIRTUAL_HOST=myapp.dev
Outputs
> phantomjs-prebuilt#2.1.14 install /usr/local/lib/node_modules/phantomjs-prebuilt
> node install.js
Considering PhantomJS found at /usr/local/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1497270232242/phantomjs-2.1.1-linux-x86_64 -> /usr/ local/lib/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-149727 0232242/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom'
errno: -13,
code: 'EACCES',
syscall: 'link',
path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1497270232242/phantomjs-2.1.1-linux-x86_64',
dest: '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs- 2.1.1-linux-x86_64.tar.bz2-extract-1497270232242/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/ph antom'
npm info lifecycle phantomjs-prebuilt#2.1.14~install: Failed to exec install script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt#2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt#2.1.14 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-06-12T12_23_56_471Z-debug.log
I tried to add USER root before the global npm install but nothing changes.
Any help apreciated
I have the same issue, and this works for me.
sudo npm install -g phantomjs#2.1.1 --unsafe-perm
https://github.com/Medium/phantomjs/issues/707#issuecomment-320989493
I'm trying to deploy a react.js app to github pages (I'm following this guide https://medium.freecodecamp.com/surge-vs-github-pages-deploying-a-create-react-app-project-c0ecbf317089) but I keep getting the following error when I run npm run deploy
ENOENT: no such file or directory, stat '/Users/name/Documents/Web Dev/100 Web Projects/wikipediaviewer/build'
npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! wikipediaviewer#1.0.0 deploy: `npm run build&&gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wikipediaviewer#1.0.0 deploy script 'npm run build&&gh-pages -d build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wikipediaviewer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build&&gh-pages -d build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs wikipediaviewer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls wikipediaviewer
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/name/Documents/Web Dev/100 Web Projects/wikipediaviewer/npm-debug.log
Can anyone pls help me figure out what I am doing wrong? If i run npm run build it builds successfully. Also i didn't use create-react-app to build this app, could that be the issue & what would I have to do to fix it.
It seems like you didn't create a build folder after you ran npm run build, so that you should change gh-pages -d path-to-your-build
since this morning I'm encountering an error in the build process of my React application using Bitbucket Pipelines. Nothing has changed to my applications other than a few tweaks that has should not trigger this error.
When I try to build my app locally I don't get any errors whatsoever. Beneath you can find the error NPM throws in Pipelines.
+ npm run build-debug
npm info it worked if it ends with ok
npm info using npm#2.15.9
npm info using node#v4.6.0
npm info prebuild-debug webplayer#0.1.2
npm info build-debug webplayer#0.1.2
> webplayer#0.1.2 build-debug /opt/atlassian/pipelines/agent/build
> node scripts/build-debug.js
Creating an optimized production build...
Failed to compile.
Module not found: Error: Cannot resolve module 'promise-polyfill' in /opt/atlassian/pipelines/agent/build/node_modules/firebase/app
npm info webplayer#0.1.2 Failed to exec build-debug script
npm ERR! Linux 4.9.16-coreos-r1
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build-debug"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! webplayer#0.1.2 build-debug: `node scripts/build-debug.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webplayer#0.1.2 build-debug script 'node scripts/build-debug.js'.
npm ERR! This is most likely a problem with the webplayer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build-debug.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs webplayer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls webplayer
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /opt/atlassian/pipelines/agent/build/npm-debug.log
Thanks in advance!
For people having this issue I found a fix.
All of our projects using firebase at our company where not able to get trough bitbucket pipelines or Docker containers. After some research it occurs that for some reason the npm package promise-polyfill doesn't exist anymore in the Node version 4.0.0 registry or something? We updated our container images to Node version 7.9.0 and everything works fine now!