I have this package.json:
{
"name": "lahmacun",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "standard --verbose | snazzy",
"lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
"fixcode": "standard --fix",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
"clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
"newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean && npm i",
"test": "ava",
"test:watch": "ava --watch",
"coverage": "nyc ava && nyc report --reporter=html && open coverage/index.html || xdg-open coverage/index.html",
"android:build": "cd android && ./gradlew assembleRelease",
"android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease",
"android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk",
"android:devices": "$ANDROID_HOME/platform-tools/adb devices",
"android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
"android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
"precommit": "npm run git-hook",
"prepush": "npm run git-hook",
"git-hook": "npm run lint -s && npm test -s"
},
"dependencies": {
"apisauce": "^0.10.0",
"format-json": "^1.0.3",
"lodash": "^4.17.2",
"querystringify": "0.0.4",
"ramda": "^0.23.0",
"react": "15.4.2",
"react-native": "0.42.0",
"react-native-animatable": "^1.1.0",
"react-native-config": "^0.2.1",
"react-native-device-info": "^0.10.0",
"react-native-drawer": "^2.3.0",
"react-native-i18n": "^1.0.0",
"react-native-router-flux": "^3.37.0",
"react-native-vector-icons": "^4.0.0",
"react-navigation": "^1.0.0-beta.6",
"react-redux": "^5.0.2",
"redux": "^3.6.0",
"redux-persist": "^4.1.0",
"redux-saga": "^0.14.3",
"reduxsauce": "0.4.1",
"seamless-immutable": "^7.0.1"
},
"devDependencies": {
"ava": "^0.18.2",
"babel-eslint": "^7.1.1",
"babel-preset-es2015": "^6.18.0",
"enzyme": "^2.6.0",
"husky": "^0.13.1",
"ignite-animatable": "^0.3.1",
"ignite-dev-screens": "^2.0.0-beta.1",
"ignite-i18n": "^0.1.1",
"ignite-ir-boilerplate-2016": "^0.2.0",
"ignite-vector-icons": "^0.2.1",
"mockery": "^2.0.0",
"nyc": "^10.1.2",
"react-addons-test-utils": "^15.3.1",
"react-dom": "^15.4.0",
"react-native-mock": "^0.3.1",
"reactotron-apisauce": "^1.7.0",
"reactotron-react-native": "^1.7.0",
"reactotron-redux": "^1.7.0",
"reactotron-redux-saga": "^1.7.0",
"snazzy": "^6.0.0",
"standard": "8.6.0"
},
"ava": {
"files": [
"Tests/**/*.js",
"!Tests/Setup.js"
],
"require": [
"babel-register",
"babel-polyfill",
"react-native-mock/mock",
"./Tests/Setup"
],
"babel": "inherit"
},
"standard": {
"parser": "babel-eslint",
"globals": [
"describe",
"it",
"fetch",
"navigator",
"__DEV__",
"XMLHttpRequest",
"FormData",
"React$Element"
]
},
"config": {
"ghooks": {
"pre-commit": "if [ -d 'ignite-base' ]; then cd ignite-base; fi; npm run lint"
}
}
}
And when I run following command locally, it works absolutely fine.
lint --xml test.xml *
But in Jenkins after npm install in the shell script, I get this error after the errors have been displayed successfully:
03:56:48 ✖ 115484 problems
03:56:48
03:56:48 npm ERR! Linux 4.4.0-62-generic
03:56:48 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "lint" "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"
03:56:48 npm ERR! node v7.7.2
03:56:48 npm ERR! npm v4.1.2
03:56:48 npm ERR! code ELIFECYCLE
03:56:48 npm ERR! MyTest1#0.0.1 lint: `standard --verbose | snazzy "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"`
03:56:48 npm ERR! Exit status 1
03:56:48 npm ERR!
03:56:48 npm ERR! Failed at the MyTest1#0.0.1 lint script 'standard --verbose | snazzy "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"'.
03:56:48 npm ERR! Make sure you have the latest version of node.js and npm installed.
03:56:48 npm ERR! If you do, this is most likely a problem with the MyTest1 package,
03:56:48 npm ERR! not with npm itself.
03:56:48 npm ERR! Tell the author that this fails on your system:
03:56:48 npm ERR! standard --verbose | snazzy "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"
03:56:48 npm ERR! You can get information on how to open an issue for this project with:
03:56:48 npm ERR! npm bugs MyTest1
03:56:48 npm ERR! Or if that isn't available, you can get their info via:
03:56:48 npm ERR! npm owner ls MyTest1
03:56:48 npm ERR! There is likely additional logging output above.
03:56:48
03:56:48 npm ERR! Please include the following file with any support request:
03:56:48 npm ERR! /root/.jenkins/jobs/smayle/workspace/npm-debug.log
03:56:48 Build step 'Execute shell' marked build as failure
03:56:48 Finished: FAILURE
All I am doing in Jenkins in the shell script is this:
npm install
npm run lint *
Related
I'm trying to deploy my Sveltekit App in Railway
Whenever I try to run
docker run --publish 8000:8000 my_project
I get back
> my-project#0.0.1 build
> vite build
sh: vite: not found
This is my dockerfile
# syntax=docker/dockerfile:1
FROM node:19.4.0-alpine3.16
ENV NODE_ENV=production
WORKDIR /app
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install
RUN npm install dotenv
RUN npm install #directus/sdk
RUN npm install vite
COPY . .
CMD [ "npm", "run", "build" ]
This is my package.json file
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"test": "playwright test",
"test:unit": "vitest",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"dependencies": {
"#directus/sdk": "^10.3.1",
"dotenv": "^16.0.3"
}
}
Script and dependencies above
The devDependencies are the following, at least the ones I found competent
"devDependencies": {
"#sveltejs/adapter-auto": "^1.0.0",
"#sveltejs/kit": "^1.0.0",
"svelte": "^3.54.0",
"svelte-check": "^2.9.2",
"vite": "^4.0.0",
"vitest": "^0.25.3"
},
Despite trying everything I know how to do and doing a ton of searching I cannot figure out what is wrong. I am trying to launch an older project in docker. The package.json file is set to install gulp#3.9.1 but when the Dockerbuild runs and installs the packages it installs 4.0.2 every time.
How can I get my docker image to install the correct version of gulp?
Dockerfile
WORKDIR /var/www
#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt update
RUN apt install -y nodejs lsof
#Install NPM deps
COPY ./package-lock.json /var/www/package-lock.json
COPY ./package.json /var/www/package.json
RUN npm install --quiet >> /dev/null \
&& npm link gulp \
&& gulp -v
package.json
"devDependencies": {
"gulp": "^3.9.1",
}
package-lock.json
"gulp": {
"version": "3.9.1",
"resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz",
"integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=",
"dev": true,
"requires": {
"archy": "^1.0.0",
"chalk": "^1.0.0",
"deprecated": "^0.0.1",
"gulp-util": "^3.0.0",
"interpret": "^1.0.0",
"liftoff": "^2.1.0",
"minimist": "^1.1.0",
"orchestrator": "^0.3.0",
"pretty-hrtime": "^1.0.0",
"semver": "^4.1.0",
"tildify": "^1.0.0",
"v8flags": "^2.0.2",
"vinyl-fs": "^0.3.0"
},
"dependencies": {
"semver": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=",
"dev": true
}
}
},
Docker Build output
Step 12/20 : RUN npm install --quiet >> /dev/null && npm link gulp && gulp -v
---> Running in 8dc99b37ab8a
/usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/gulp/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ gulp#4.0.2
added 314 packages from 217 contributors in 16.348s
/var/www/node_modules/gulp -> /usr/lib/node_modules/gulp
CLI version: 2.2.0
Local version: 4.0.2
npm install is taking (30+) minutes in server which runs on debian 9.8.
I want to know what might cause this?
I've already tried npm set progress=false and npm config set registry http://registry.npmjs.org/ but none of it helped.
I'm running it in docker container.
this is my package.json
{
"name": "name",
"version": "1.0.0",
"main": "server/server.js",
"engines": {
"node": ">=6"
},
"scripts": {
"lint": "eslint .",
"start": "nodemon .",
"client": "cd client && npm start",
"test": "mocha"
},
"dependencies": {
"babel-eslint": "^10.0.1",
"compression": "^1.0.3",
"cors": "^2.5.2",
"eslint-config-react-app": "^4.0.0",
"eslint-plugin-flowtype": "^3.7.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-hooks": "^1.6.0",
"express-jwt": "^5.3.1",
"express-winston": "^3.2.0",
"helmet": "^3.10.0",
"html-element": "^2.3.0",
"jwks-rsa": "^1.5.1",
"libxmljs": "^0.19.5",
"loopback": "^3.22.0",
"loopback-boot": "^2.6.5",
"loopback-component-explorer": "^6.2.0",
"loopback-connector-mongodb": "^4.2.0",
"loopback-connector-rest": "^3.4.1",
"node": "8.16.0",
"node-blockly": "^1.0.36",
"serve-favicon": "^2.0.1",
"strong-error-handler": "^3.0.0",
"winston": "^3.2.1"
},
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^3.17.1",
"eslint-config-loopback": "^8.0.0",
"loopback-supertest-models": "^3.5.0",
"mocha": "^6.1.4",
"nodemon": "^1.19.0",
"supertest": "^4.0.2"
},
"repository": {
"type": "",
"url": ""
},
"license": "UNLICENSED",
"description": "description"
}
and this is my Dockerfile
FROM node:10.9.0-alpine as builder
RUN mkdir -p /app/server
WORKDIR /app/server
COPY package*.json /app/server/
#COPY yarn* /app/server/
# Disables npm progress bar
RUN npm set progress=false
# Set npm registry to http://registry.npmjs.org
RUN npm config set registry http://registry.npmjs.org/
#! Install the build requirements for bcrypt
RUN apk update && apk upgrade \
&& apk --no-cache add --virtual git builds-deps build-base \
&& apk --no-cache add make gcc g++ python \
&& npm install --save node-gyp node-pre-gyp \
&& rm -rf /var/cache/apk/*
# && yarn add node-gyp node-pre-gyp
# Install dependencies
# RUN yarn install --production=true
RUN npm install --production
# Copy the server files over
COPY . /app/server/
RUN apk del make gcc g++ python
FROM node:10.9.0-alpine
# Create and set the working directory
RUN mkdir -p /app/server
WORKDIR /app/server
# Copy the server from the build container
COPY --from=builder /app/server /app/server
CMD ["node", "."]
I am having issue installing bcrypt on my docker.
my node application need bcrypt do encrypt user data. I used npm install bcrypt --save to install on my local computer and this seem to be working well. Now I want to dockerize my application.
My Dockerfile look like this.
FROM node:10.12.0
RUN npm install --global node-pre-gyp
RUN apt-get update && apt-get install -y build-essential && apt-get install -y python && npm install
RUN mkdir -p /usr/src/app
RUN whoami
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install nodemon -g --save
RUN npm install
RUN node -v
RUN npm install bcrypt -g --save
# RUN npm install bcrypt - g --save
# CMD [ 'pm2', 'start', 'app.js' '--log-date-format' "'YYYY-MM-DD HH:mm Z'" ]
CMD [ "nodemon" ]
my package.json file looks like this:
{
"name": "api",
"version": "1.0.0",
"description": "Best app",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "name",
"license": "ISC",
"dependencies": {
"bcrypt": "^3.0.2",
"config": "^2.0.1",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"joi": "^14.0.0",
"joi-objectid": "^2.0.0",
"jsonwebtoken": "^8.3.0",
"lodash": "^4.17.11",
"mongoose": "^5.3.4",
"multer": "^1.4.1",
"nodemailer": "^4.7.0",
"nodemon": "^1.18.4",
"stripe": "^6.15.0"
}
}
When I try to build with docker build .
This error occurs:
Sending build context to Docker daemon 226 MB
Step 1/12 : FROM node:10.12.0
---> a2b9536415c2
Step 2/12 : RUN npm install --global node-pre-gyp
---> Using cache
---> c76403d98dd5
Step 3/12 : RUN apt-get update && apt-get install -y build-essential && apt-get install -y python && npm install
---> Using cache
---> 7926c2a74e90
Step 4/12 : RUN mkdir -p /usr/src/app
---> Using cache
---> 5ecb4eb08f05
Step 5/12 : RUN whoami
---> Using cache
---> e5ff9b23c652
Step 6/12 : WORKDIR /usr/src/app
---> Using cache
---> d0f9dd01719b
Step 7/12 : COPY . /usr/src/app
---> 30d30749e5d4
Removing intermediate container a20cfaca9bb3
Step 8/12 : RUN npm install nodemon -g --save
---> Running in a495bc73977f
/usr/local/bin/nodemon -> /usr/local/lib/node_modules/nodemon/bin/nodemon.js
> nodemon#1.18.7 postinstall /usr/local/lib/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/nodemon/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ nodemon#1.18.7
added 223 packages from 130 contributors in 12.461s
---> 9bb36a08bd55
Removing intermediate container a495bc73977f
Step 9/12 : RUN npm install
---> Running in f544752d8d41
npm WARN api#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
audited 2580 packages in 3.287s
found 1 critical severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
---> 5982d518a0e8
Removing intermediate container f544752d8d41
Step 10/12 : RUN node -v
---> Running in a08d0492d376
v10.12.0
---> c41e54a1910c
Removing intermediate container a08d0492d376
Step 11/12 : RUN npm install bcrypt -g --save
---> Running in 874f9d8d7bcf
> bcrypt#3.0.2 install /usr/local/lib/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for bcrypt#3.0.2 and node#10.12.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bcrypt/lib'
gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/10.12.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/bcrypt/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bcrypt/.node-gyp'
gyp ERR! System Linux 4.15.0-42-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/local/lib/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /usr/local/lib/node_modules/bcrypt
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Linux 4.15.0-42-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/bcrypt
node-pre-gyp ERR! node -v v10.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/local/lib/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.2 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/2018-12-07T15_41_19_990Z-debug.log
The command '/bin/sh -c npm install bcrypt -g --save' returned a non-zero code: 1
This is working find on my local ubuntu 18.04, but not on docker.
Any idea what is wrong ?
When I want to copy the ember-app-kit-master file in my project, I execute
cmd: cd C:\Users\hp-pc\Desktop\MyApp
then
cmd: npm install
But I got some errors:
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\\Publish\\nodeJs\\\\node.exe" "G:\\Publish\\nodeJs\\node_mo
dules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\hp-pc\Desktop\MyApp
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.9
npm ERR! code ENOGIT
This is part of my package.json :
"repository": {
"type": "git",
"url": "git://github.com/stefanpenner/ember-app-kit.git"
},
"devDependencies": {
"load-grunt-config": "git://github.com/Pradeek/load-grunt-config.git",
}
When I remove settings about git, it works fine. Why is that?
You have to install Git-scm on your computer. NPM uses git to get the repos. Also, the command npm docs can be used with github to fetch the docs. So perhaps npm checks if got is installed. http://git-scm.com/downloads