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
Related
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.
Error:
$ heroku run npm run migrate
Running npm run migrate on ⬢ shelly-moth-73910... up, run.3979 (Free)
> noteful-app-server#1.0.0 migrate /app
> postgrator --config postgrator-config.js
sh: 1: postgrator: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! noteful-app-server#1.0.0 migrate: `postgrator --config postgrator-config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the noteful-app-server#1.0.0 migrate 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! /app/.npm/_logs/2020-09-06T07_52_36_217Z-debug.log
postgrator-cli version 4.0.0 is installed on repo, running npm list postgrator-cli tells me that. But after I push to heroku it's as though postgrator doesn't exist. heroku run npm install postgrator-cli and other such commands don't change, and heroku run npm list postgrator-cli returns:
$ heroku run npm list postgrator-cli
Running npm list postgrator-cli on ⬢ rocky-garden-73910... up, run.7024 (Free)
noteful-app-server#1.0.0 /app
`-- (empty)
Here's my postgrator-config.js
require('dotenv').config();
module.exports = {
'migrationsDirectory': 'migrations',
'driver': 'pg',
'connectionString':
process.env.NODE_ENV === 'test'
? process.env.TEST_DATABASE_URL
: process.env.DATABASE_URL,
'ssl': !!process.env.SSL,
};
Procfile contains web: node src/server.js
I just had the same error.
In my package.json I found that it was in my "devDependencies", not my "dependencies".
When I first installed it, I ran npm i postgrator-cli -D, making it a development dependency. When I tried installing it again without the -D it didn't do anything, so I deleted it from my package.json.
Then, I ran npm i postgrator-cli and checked my package.json and found that it was in my dependencies. I git added, committed, and pushed to heroku and then I ran heroku run npm run migrate - it worked!
Our team created a react web app and want to use github action to push the project to Kuberntes. Here is the Dockerfile:
### STAGE 1: Build ###
FROM node:14.5.0 as build
RUN mkdir -p /src/app
WORKDIR /src/app
# Install app dependencies
COPY package.json /src/app/
RUN npm install && \
npm install -g pushstate-server
# Bundle app source
COPY . /src/app
# Build and optimize react app
RUN npm run build:staging
### STAGE 2: Production Environment ###
FROM nginx:1.19.2
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
when I run docker locally with command
docker build --tag abc:test .
It built the image successfully. But when I push it github action, it will stop at RUN npm run build:staging. And the Error message is
/src/app/src/Components/SideBar/SideBarLinks/index.tsx
TypeScript error in /src/app/src/Components/SideBar/SideBarLinks/index.tsx(124,9):
Property 'children' is missing in type '*** onEntered: () => void; ***' but required in type 'CollapseProps'. TS2741
122 | dropdownWrapperProps=*** 'data-tour': 'support-wrapper' ***
123 | dropdownToggleProps=*** 'data-tour': 'support-dropdown-button' ***
> 124 | collapseProps=***
| ^
125 | onEntered: () => ***
126 | const sidebarItemsWrapper = document.querySelector(
127 | '.side-bar-items-wrapper'
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/2020-09-21T06_19_14_044Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard_redo#4.0.0 api:staging: `cross-env REACT_APP_API_BASE_URL=https://staging.jetsonai.com/api/v3 npm run integrations-url:staging "npm" "run" "build"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dashboard_redo#4.0.0 api:staging 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/2020-09-21T06_19_14_076Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard_redo#4.0.0 build:staging: `cross-env REACT_APP_MODE=test npm run api:staging npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dashboard_redo#4.0.0 build:staging 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/2020-09-21T06_19_14_093Z-debug.log
The command '/bin/sh -c npm run build:staging' returned a non-zero code: 1
##[error]Process completed with exit code 1.
Any idea?
I am trying to deploy a react app using GitLab-ci when I build on local it works fine but when building on the pipeline I get the error just before the build complete:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spinspace-admin#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spinspace-admin#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! /root/.npm/_logs/2020-05-20T18_07_19_210Z-debug.log
Running after_script
00:01
Uploading artifacts for failed job
00:02
ERROR: Job failed: exit code 1
This is the before_script in my GitLab-ci.yaml
before_script:
- apt-get update
- npm install
- npm run build
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
please I need help...
I've recently generated a new ssh key on my mac and I can't seem to install angular/cli anymore. When I try to run npm install -g angular/cli I get this error:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git#github.com/angular/cli.git
npm ERR!
npm ERR! ERROR: Repository not found.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
At the same time typescript installed perfectly fine. My npm version is 5.3.0 and node version is 8.2.1.
Thanks in advance!
I was using the incorrect repo name. It should have been:
npm install -g #angular/cli
Notice the #.