I want to run a app on heroku using Dockerfile but it can`t run npm intsall
This is my Dockerfile:
FROM ubuntu:18.04
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y nodejs \
npm
RUN apt-get update && \
apt-get install -y \
ffmpeg \
imagemagick \
webp && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*
COPY package.json .
RUN npm install
CMD ["node", "index.js"]
and this is error:
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
WARN engine mongoose#6.6.2: wanted: {"node":">=12.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1
This is my app github reposity. Run using heroku.
Any idea how to solve this problem?
Related
I have a docker file I have built that uses the arm64v8/ arch type (I use an M1 Mac), no issues during the build at all, but as soon as try and install any npm dependencies I am met with this output:
root#456d8199a91d:/var/www/html# npm install
npm ERR! code 1
npm ERR! path /var/www/html/node_modules/optipng-bin
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! compiling from source
npm ERR! Command failed: /var/www/html/node_modules/optipng-bin/vendor/optipng --version
npm ERR! qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
npm ERR!
npm ERR!
npm ERR! optipng pre-build test failed
npm ERR! Error: Command failed: /bin/sh -c make install
npm ERR! pngrtran.c:99:1: warning: 'png_rtran_ok' defined but not used [-Wunused-function]
npm ERR! 99 | png_rtran_ok(png_structrp png_ptr, int need_IHDR)
npm ERR! | ^~~~~~~~~~~~
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! pngxmem.c: In function 'pngx_malloc_rows_extended':
npm ERR! pngxmem.c:38:34: warning: comparison is always false due to limited range of data type [-Wtype-limits]
npm ERR! 38 | (pngx_alloc_size_t)height > (pngx_alloc_size_t)(-1) / sizeof(png_bytep))
npm ERR! | ^
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! /usr/bin/ld: ../libpng/libpng.a(pngrutil.o): in function `png_read_filter_row':
npm ERR! pngrutil.c:(.text+0x1f64): undefined reference to `png_init_filter_functions_neon'
npm ERR! collect2: error: ld returned 1 exit status
npm ERR! make[1]: *** [Makefile:100: optipng] Error 1
npm ERR! make: *** [Makefile:14: install] Error 2
I notice that it mentions '/lib64/ld-linux-x86-64.so.2' which I only saw previously when trying to use the amd64 arch type for the same image build. My Dockerfile config is as follows:
FROM arm64v8/php:8.1-apache
RUN apt-get update
EXPOSE 80
RUN apt-get install -y \
git \
zip \
curl \
sudo \
unzip \
libicu-dev \
libbz2-dev \
libpng-dev \
libjpeg-dev \
libmcrypt-dev \
libreadline-dev \
libfreetype6-dev \
libonig-dev \
libzip-dev \
nodejs \
npm \
g++
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN a2enmod rewrite headers
RUN docker-php-ext-install \
bz2 \
intl \
iconv \
bcmath \
opcache \
calendar \
mbstring \
pdo_mysql \
zip
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions pdo_pgsql
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# This needs to be set in .env as 'UID', must match the host id, attained using 'id -u'
# prevents root ownership on apache + other saved files
ARG uid
RUN useradd -G www-data,root -u $uid -d /home/devuser devuser
RUN mkdir -p /home/devuser/.composer && \
chown -R devuser:devuser /home/devuser
# Necessary drivers for redis adapter
RUN pecl channel-update pecl.php.net
RUN pecl install -f redis
RUN sudo apt update
RUN yes | apt install vim
Im not sure why it errors with what looks to be the wrong arch type being used when I have specified FROM arm64v8/php:8.1-apache? Bare in mind I have used this config for a couple of months with no issues until today, is there something blindingly obvious I'm missing in the npm install output?
Many thanks to #CharlesDuffy , as mentioned the version of optipng-bin I was attempting to install (2.0.0) was shipped with x86_64 libraries and nothing to support arm, bumping to 4.2.0 did the trick.
I am trying to make a docker image including newman. I tried to build the image using node:10-alpine, but I got connection refused error while npm install -g newman. This is my docker command:
RUN set http_proxy= && \
set https_proxy= && \
yarn config delete proxy && \
npm config rm https-proxy && \
npm config rm proxy && \
npm config set registry http://registry.npmjs.org/ && \
npm config set strict-ssl false && \
npm cache clean --force && \
npm cache verify && \
npm install -g newman
The full error is:
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npmjs.org/newman failed, reason: connect ECONNREFUSED 192.168.14.109:1087
npm ERR! at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:198:13)
npm ERR! at onerror (/usr/local/lib/node_modules/npm/node_modules/agent-base/index.js:101:9)
npm ERR! at callbackError (/usr/local/lib/node_modules/npm/node_modules/agent-base/index.js:123:5)
npm ERR! at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! { FetchError: request to https://registry.npmjs.org/newman failed, reason: connect ECONNREFUSED 192.168.14.109:1087
npm ERR! at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:198:13)
npm ERR! at onerror (/usr/local/lib/node_modules/npm/node_modules/agent-base/index.js:101:9)
npm ERR! at callbackError (/usr/local/lib/node_modules/npm/node_modules/agent-base/index.js:123:5)
npm ERR! at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! message:
npm ERR! 'request to https://registry.npmjs.org/newman failed, reason: connect ECONNREFUSED 192.168.14.109:1087',
npm ERR! type: 'system',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! code: 'ECONNREFUSED',
npm ERR! stack:
npm ERR! 'FetchError: request to https://registry.npmjs.org/newman failed, reason: connect ECONNREFUSED 192.168.14.109:1087\n at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)\n at ClientRequest.emit (events.js:198:13)\n at onerror (/usr/local/lib/node_modules/npm/node_modules/agent-base/index.js:101:9)\n at callbackError (/usr/local/lib/node_modules/npm/node_modules/agent-base/index.js:123:5)\n at process._tickCallback (internal/process/next_tick.js:68:7)' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-03-02T14_57_46_444Z-debug.log
Then I tried to make my image from alpine:3.8 which gives me repository error while apk update. This is my second version:
RUN apk update && apk add --no-cache nodejs npm
RUN npm install -g newman
Full error log is:
Step 5/7 : RUN apk update && apk add --no-cache nodejs npm
---> Running in 6149b2571389
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/main: operation timed out
WARNING: Ignoring APKINDEX.adfa7ceb.tar.gz: No such file or directory
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/community: operation timed out
WARNING: Ignoring APKINDEX.efaa1f73.tar.gz: No such file or directory
2 errors; 13 distinct packages available
The command '/bin/sh -c apk update && apk add --no-cache nodejs npm' returned a non-zero code: 2
I also tried to build the image with --network=hostoption; but got the same errors in both versions.
Additionally ping dl-cdn.alpinelinux.org works fine on my system.
Besides, restarted the docker service, sudo systemctl restart docker, and tried one more time. Got the same results again.
In my case works with this steps:
In the Host, I change Host Server
/etc/sysctl.conf:
I added
net.ipv4.ip_forward=1
I use
nslookup registry.npmjs.org
Give me the IP 104.16.25.38
Docker Build with IP
docker build . --add-host registry.npmjs.org:104.16.25.38 -t test
In my case works with this below single step,
docker build --add-host registry.npmjs.org:104.16.25.38 -t .
I have dockerfile containing the angular build section as below.
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN npm config set registry https://shnexus0.sohard.de/repository/sedi.npm.development/
RUN npm i -g #angular/cli#latest
RUN npm install
RUN npm install -g typescript
In the jenkins pipeline build I am getting the below error.
error TS2307: Cannot find module '#angular/core'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! dicom-web-viewer#0.0.0 tsc: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the dicom-web-viewer#0.0.0 tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Even though I have npm install in the dockerfile. It is showing the error for node module. Thanks in advance.
Running docker jenkins instance and trying to run the following command:
npm install --cache-min 9999
Following Error:
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://blahblahblah.com/api/npm/npmjs-repos/settings failed, reason: write EPROTO 140625881564992:error:14094410:SSL
routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl
/openssl/ssl/record/rec_layer_s3.c:1536:SSL alert number 40
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-08-19T16_06_12_164Z-debug.log
Post stage
node -v :: v10.16.3
npm -v :: 2.15.11
DOCKERFILE
RUN npm install protractor#^5.0.0 -g &&\
npm install jasmine#^2.5.2 -g &&\
npm install jasmine-reporters#^2.2.0 -g &&\
npm install jasmine-spec-reporter#^3.1.0 -g &&\
npm install protractor-jasmine2-html-reporter#0.0.6 -g &&\
npm install typescript#^2.0.7 -g &&\
npm install axios#0.18.0 -g &&\
webdriver-manager update
Showing below error while trying to install appium.
While doing sudo npm install -g appium.
npm ERR! Error: Invalid name: "#gulp-sourcemaps/map-sources"
npm ERR! at ensureValidName (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:284:15)
npm ERR! at Object.module.exports.fixNameField (/usr/lib/nodejs/normalize-package-data/lib/fixer.js:199:5)
npm ERR! at /usr/lib/nodejs/normalize-package-data/lib/normalize.js:29:38
npm ERR! at Array.forEach (native)
npm ERR! at normalize (/usr/lib/nodejs/normalize-package-data/lib/normalize.js:28:15)
npm ERR! at final (/usr/lib/nodejs/read-package-json/read-json.js:310:33)
npm ERR! at then (/usr/lib/nodejs/read-package-json/read-json.js:124:33)
npm ERR! at /usr/lib/nodejs/read-package-json/read-json.js:234:40
npm ERR! at fs.js:268:14
npm ERR! at /usr/lib/nodejs/graceful-fs/graceful-fs.js:103:5
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.13.0-137-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "appium"
npm ERR! cwd /home/mosheko
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/mosheko/npm-debug.log
npm ERR! not ok code 0
It might be helpful. Steps to get appium working on ubuntu pc:
Install ruby: Paste the below command at terminal and hit enter
sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
Install linux brew:
Paste the below command at terminal and hit enter
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
set path for brew: Type: gedit .bashrc at terminal and copy paste the following into the .bashrc file
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Install node: Paste the below commands one by one at terminal and hit enter
brew update
brew install node
brew link node
Install Appium:
npm install -g appium npm install wd
To start Appium: Paste the below command at terminal and hit enter
appium
Thanks
Install Java and check the Java version
Step 1 : Java -version
Install Node.js and npm from the Ubuntu repository.
Step 2 : sudo apt update
Step 3 : sudo apt install nodejs
Step 4 : nodejs --version
Out Put : v8.10.0 (version of the Node)
Step 5 : sudo apt install npm
Step 6 : npm --version (npm version).
Step 7 : 3.5.2
Step 8 : sudo npm install -g appium
Step 9 : npm install wd
Step 10 : npm install -g appium-doctor
To verify “Appium” installation we can use appium-doctor. For this, we have to install appium doctor using npm.
Step 11 : appium-doctor
Step 12 : Type “appium” into the terminal and press enter button.
Appium will start.