docker build vue3 not compatible with element-ui on node:16-buster-slim - node.js

dockerfile:
FROM node:16-buster-slim
RUN apt-get update
WORKDIR /app
COPY package.json /home
RUN npm install --prefix /home
package.json
{
"name": "test",
"version": "0.1.0",
"private": false,
"scripts": {
"dev": "vue-cli-service serve --mode development --host 0.0.0.0",
"serve": "vue-cli-service serve --mode production --host 0.0.0.0",
"build": "vue-cli-service build",
"jest": "vue-cli-service test:unit --watchAll",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.4",
"core-js": "^3.6.5",
"dateformat": "^5.0.2",
"element-plus": "^1.1.0-beta.9",
"element-ui": "^2.15.6",
"lib-flexible": "^0.3.2",
"ol": "^6.6.1",
"spark-md5": "^3.0.2",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
"vuelayers": "^0.11.36",
"vuex": "^4.0.0-0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-unit-jest": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"#vue/eslint-config-standard": "^5.1.2",
"#vue/test-utils": "^2.0.0-0",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0",
"fs-extra": "^10.0.0",
"lint-staged": "^9.5.0",
"mockjs": "^1.1.0",
"node-sass": "^4.14.1",
"px2rem-loader": "^0.1.9",
"sass-loader": "^8.0.2",
"typescript": "~3.9.3",
"vue-jest": "^5.0.0-0"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue}": [
"vue-cli-service lint",
"git add"
]
}
}
Step: RUN npm install --prefix /home
---> Running in fc08d7e933ed npm notice
npm notice New patch version of npm available! 8.1.0 -> 8.1.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.4
npm notice Run npm install -g npm#8.1.4 to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: artemis#0.1.0
npm ERR! Found: vue#3.2.22
npm ERR! node_modules/vue
npm ERR! vue#"^3.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^2.5.17" from element-ui#2.15.6
npm ERR! node_modules/element-ui
npm ERR! element-ui#"^2.15.6" 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 /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-11-25T01_40_08_953Z-debug.log
but this package.json work well on node:lts-alpine base image

It seems that you have problems with peer dependencies, if you just set your npm to use legacy dependency logic to install your packages you will solve the problem.
Just add to your Dockerfile this setting before running npm install:
...
COPY package.json /home
RUN npm config set legacy-peer-deps true
RUN npm install --prefix /home
To understand what this flag does I suggest you read this SO answer where it is explained extensively.

Related

Why i receive error message while install typeorm?

I tried to build my project with Jenkins.
Node version: 16.16.0
Npm version: 8.11.0
Env: Ubuntu 20.04.4 LTS
Jenkins pulled git repo and tried to install dependencies.
I installed nodejs plugin to jenkins.
If i tried run npm i manually from /var/lib/jenkins/workspace it shows me same error log.
npm i working correctly on my local machine (Windows 10)
Also i tried to re-install node and npm with versions from my local machine, but nothing happened :(
My error log:
00:07:51 npm ERR! code ERESOLVE
00:07:51 npm ERR! ERESOLVE could not resolve
00:07:51 npm ERR!
00:07:51 npm ERR! While resolving: #nestjs/typeorm#8.0.3
00:07:51 npm ERR! Found: typeorm#0.3.6
00:07:51 npm ERR! node_modules/typeorm
00:07:51 npm ERR! typeorm#"^0.3.6" from the root project
00:07:51 npm ERR!
00:07:51 npm ERR! Could not resolve dependency:
00:07:51 npm ERR! peer typeorm#"^0.2.34" from #nestjs/typeorm#8.0.3
00:07:51 npm ERR! node_modules/#nestjs/typeorm
00:07:51 npm ERR! #nestjs/typeorm#"^8.0.3" from the root project
00:07:51 npm ERR!
00:07:51 npm ERR! Conflicting peer dependency: typeorm#0.2.45
00:07:51 npm ERR! node_modules/typeorm
00:07:51 npm ERR! peer typeorm#"^0.2.34" from #nestjs/typeorm#8.0.3
00:07:51 npm ERR! node_modules/#nestjs/typeorm
00:07:51 npm ERR! #nestjs/typeorm#"^8.0.3" from the root project
00:07:51 npm ERR!
00:07:51 npm ERR! Fix the upstream dependency conflict, or retry
00:07:51 npm ERR! this command with --force, or --legacy-peer-deps
00:07:51 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
00:07:51 npm ERR!
00:07:51 npm ERR! See /var/lib/jenkins/.npm/eresolve-report.txt for a full report.
00:07:51
00:07:51 npm ERR! A complete log of this run can be found in:
00:07:51 npm ERR! /var/lib/jenkins/.npm/_logs/2022-07-20T21_07_43_903Z-debug-0.log
package.json file:
{
"name": "teach-me-grow",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"#nestjs/common": "^8.0.0",
"#nestjs/core": "^8.0.0",
"#nestjs/passport": "^8.2.1",
"#nestjs/platform-express": "^8.0.0",
"#nestjs/swagger": "^5.2.1",
"#nestjs/typeorm": "^8.0.3",
"class-validator": "^0.13.2",
"connect-typeorm": "^1.1.4",
"dotenv": "^16.0.1",
"express-session": "^1.17.3",
"module-alias": "^2.2.2",
"passport": "^0.5.3",
"passport-facebook": "^3.0.0",
"passport-google-oauth20": "^2.0.0",
"passport-local": "^1.0.0",
"pg": "^8.7.3",
"pg-hstore": "^2.3.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"swagger-ui-express": "^4.4.0",
"typeorm": "^0.3.6"
},
"devDependencies": {
"#nestjs/cli": "^8.0.0",
"#nestjs/schematics": "^8.0.0",
"#nestjs/testing": "^8.0.0",
"#types/express": "^4.17.13",
"#types/jest": "27.5.0",
"#types/node": "^16.0.0",
"#types/supertest": "^2.0.11",
"#typescript-eslint/eslint-plugin": "^5.0.0",
"#typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "28.0.3",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.1",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.0.0",
"typescript": "^4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"_moduleAliases": {
"#app": "./dist"
}
}
Looking on nestjs/typeorm in version 8.0.3 it has fixed version of typeorm package in its dependencies (package.json: https://github.com/nestjs/typeorm/blob/8.0.3/package.json)
If you want to stick to nestjs/typeorm 8.0.3 version lower your typeorm version to 0.2.45 or upgrade nestjs/typeorm version to one which uses newer typeorm version

node-gyp-build not found when Deploying web3 App to heroku

I'm attempting to deploy a web3 application to heroku, but while building the npm dependencies, I get the following error:
remote: sh: 1: node-gyp-build: not found
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! syscall spawn
remote: npm ERR! file sh
remote: npm ERR! errno ENOENT
remote: npm ERR! bufferutil#4.0.3 install: `node-gyp-build`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the bufferutil#4.0.3 install script.
I believe this is because of the web3#1.3.6 dependency I am adding. If I leave this out of the npm dependencies in my package.json file, the deploy works successfully.
If I ssh into a console, I'm able to run npm install -g web3#1.3.6 and that is also successful. I've also tried adding node-gyp, node-gyp-build, and bufferutil as explicit dependencies in the package.json file. I'm using
node 14.17.0
npm 6.14.13
python 3.9.5
Below is my full package.json file
{
"engines": {
"node": "14.17.0",
"npm": "6.14.13"
},
"repository": {},
"description": " ",
"license": "MIT",
"scripts": {
"deploy": "webpack --mode production",
"watch": "webpack --mode development --watch"
},
"dependencies": {
"postcss": "8.1.0",
"#popperjs/core": "^2.9.2",
"bootstrap": "^5.0.1",
"jquery": "^3.6.0",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view",
"topbar": "^0.1.4",
"#babel/core": "^7.0.0",
"babel-polyfill": "^6.26.0",
"#babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.0",
"css-loader": "^5.2.6",
"sass-loader": "^10.0.0",
"node-sass": "^6.0.0",
"cropperjs": "1.5.12",
"eth-sig-util": "^1.4.2",
"jquery-cropper": "1.0.1",
"copy-webpack-plugin": "^5.1.1",
"hard-source-webpack-plugin": "^0.13.1",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"terser-webpack-plugin": "^2.3.2",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.2",
"web3": "1.3.6"
},
"devDependencies": {},
}

npm ERR! code ELIFECYCLE npm ERR! errno 126

Firsty I should do npm run build then npm run install, but no matter what to type on the server I am getting this error.
sh: 1: react-app-rewired: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! manager-polling-app-client#0.1.0 start: `react-app-rewired start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the manager-polling-app-client#0.1.0 start 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-01-08T05_17_59_301Z-debug.log
NPM install is running on my local system but fails on server.
I cleaned cache, deleted node_modules and package-lock.json and re-installed them, but it didn`t worked.
My package.json
{
"name": "manager-polling-app-client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#material-ui/core": "^3.9.3",
"ajv": "^6.0.0",
"ajv-keywords": "^3.2.0",
"antd": "^3.16.3",
"arui-feather": "^12.12.0",
"b64-to-blob": "^1.2.19",
"moment": "^2.22.2",
"pdfmake": "^0.1.53",
"prop-types": "^15.7.2",
"react": "^16.11.0",
"react-awesome-modal": "^2.0.5",
"react-data-export": "^0.5.0",
"react-dom": "^16.11.0",
"react-export-excel": "^0.5.3",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.1",
"react-select": "^2.4.2",
"xlsx": "^0.14.4"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"babel-plugin-import": "^1.11.0",
"react-app-rewire-less": "^2.1.3",
"react-app-rewired": "^1.6.2"
}
}
P.S. I found that I can change rights with chmod -R 777, but people say it`s a bad idea. Personally, it worked on the server and I do not wanna play with rights (worry that will crash it at , i think there is another way to solve issue.
P.P.S. If here I should use yarn, then I should yarn add on local system and then permanently use yarn on server?
P.P.P.S. I am really newbee in npm and in yarn... sorry if question seems stupid

npm scripts in package.json errors on exit

I'm able to run my scripts successfully, however, when i exit (ctrl + c) I get a loud error from the eslint, or jest jobs that were watching. Is there a means of suppressing these, as I get errors from the package themselves when the tests or linting fails
Example error:
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! wpauth#1.0.0 lint: `esw webpack.config.* src tools --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wpauth#1.0.0 lint script 'esw webpack.config.* src tools --color'.
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 wpauth package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! esw webpack.config.* src tools --color
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs wpauth
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls wpauth
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/gazzwi86/Sites/tokenauth/npm-debug.log
Package.json
{
"name": "wpauth",
"version": "1.0.0",
"scripts": {
"start": "npm run start:dev",
"start:dev": "npm-run-all --parallel test:watch lint:watch serve:dev open:dev",
"start:dist": "npm-run-all build open:dist serve:dist",
"prebuild": "rm -r src/main/webapp/public/secure-me && mkdir src/main/webapp/public/secure-me && npm run test && npm run lint",
"build": "webpack -p --define process.env.NODE_ENV='\"production\"' --optimize-minimize && cp ./src/ui/index.html src/main/webapp/public/secure-me/",
"lint": "esw webpack.config.* src tools --color",
"lint:watch": "npm run lint -- --watch",
"test": "jest",
"test:watch": "npm run test -- --watch",
"open:dev": "open http://localhost:8080/webpack-dev-server/",
"open:dist": "open http://localhost:8080/",
"serve:dev": "webpack-dev-server --progress --colors --content-base src/ui",
"serve:dist": "http-server src/main/webapp/public/secure-me"
},
"jest": {
"moduleNameMapper": {
"\\.(css|scss)$": "identity-obj-proxy",
"^.+\\.(gif|ttf|eot|svg|woff|woff2|ico)$": "<rootDir>/fileMock.js"
}
},
"dependencies": {
"backbone": "^1.3.3",
"jquery": "^2.2.4",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"underscore": "^1.8.3"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-jest": "^18.0.0",
"babel-loader": "^6.2.1",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.3.13",
"css-loader": "^0.26.1",
"enzyme": "^2.7.1",
"eslint": "^3.15.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^6.9.0",
"eslint-watch": "^2.1.14",
"http-server": "^0.9.0",
"image-webpack-loader": "^3.2.0",
"jest-cli": "^18.1.0",
"npm-run-all": "3.1.2",
"open": "0.0.5",
"react-addons-test-utils": "^15.4.2",
"sinon": "^1.17.7",
"style-loader": "^0.13.1",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
}
}

Npm start doesn't work in an Angular 2 and Laravel 5 project

I am working on a Laravel 5.2 and Angular 2 project and I've just finished setting up angular but when running npm start, I get the following error :
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! # postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # postinstall script 'typings install'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
Can you guys help me ?
This is the content of my package.json :
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch",
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"bootstrap-sass": "^3.0.0",
"concurrently": "^1.0.0",
"del": "^2.2.0"
},
"dependencies": {
"angular2": "2.0.0-beta.0",
"bootstrap-sass": "^3.0.0",
"elixir-typescript": "^1.1.2",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"laravel-elixir": "^4.0.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"systemjs": "0.19.6",
"zone.js": "0.5.10"
}
}
Your script is failing while trying to run 'typings install'.
1. Include typings in devDependencies
{
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4"
}
}
Run npm install
Create typings.json as below
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160807145350"
}
}
npm start
if you still having issue install typings globally
npm install typings --global
I too face this problem i do the following steps
1. i uninstall nodejs and install the latest version.
2. close the command promt and open.
3. execute npm install
4. execute npm build(not nesessery)
5. execute npm start
This works for me.

Resources