I was trying to create a docker Image where it is getting stuck at the "npm run build" step. I could see the message as build completed successfully but it is not proceeding to the next step.
below the docker file. I m using node:16.13.1 as base Image
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json ./
COPY .npmrc ./
RUN npm install node-sass#latest
RUN npm install core-js#2.5.7
RUN npm install
COPY . /usr/src/app
# build web app
RUN npm run build
EXPOSE 8080
RUN chmod +x /usr/src/app/setup.sh
CMD ["/usr/src/app/setup.sh"]
Not proceeding after the below step,
Package.json file
{
"name": "full-kyc",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"format": "prettier --write \"**/*.{js,vue,html,json,md}\" && prettier-stylelint --write --quiet '**/*.{css,scss,vue}'",
"build:dev": "vue-cli-service build --mode development --watch",
"start:dev": "NODE_ENV=development nodemon bin/www | bunyan",
"start:prod": "node bin/www | bunyan"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,vue,html,json,md}": [
"prettier --write",
"git add"
],
"*.{css,scss,vue}": [
"prettier-stylelint --write --quiet",
"git add"
]
},
"dependencies": {
"#vue/babel-preset-app": "^4.5.15",
"axios": "^0.21.4",
"body-parser": "1.18.3",
"btoa": "^1.2.1",
"bunyan": "1.8.12",
"cookie-parser": "1.4.3",
"crypto": "^1.0.1",
"express": "4.16.3",
"express-http-proxy": "1.4.0",
"raven-js": "^3.27.2",
"vue": "2.5.17",
"vue-router": "3.0.1",
"vuex": "3.0.1"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^4.5.15",
"#vue/cli-plugin-eslint": "3.0.1",
"#vue/cli-service": "3.0.1",
"babel-eslint": "^10.1.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^6.15.0",
"eslint-loader": "^2.2.1",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^5.2.3",
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"node-sass": "^4.14.1",
"nodemon": "1.18.4",
"prettier": "^1.19.1",
"prettier-stylelint": "^0.4.2",
"sass-loader": "7.0.1",
"stylelint-config-recommended": "^2.2.0",
"vue-template-compiler": "2.5.17",
"vue-smooth-picker": "file:vue-smooth-picker",
"webpack-bundle-analyzer": "^4.5.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true,
"es6": true,
"browser": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"prettier/vue",
"plugin:prettier/recommended"
],
"rules": {
"vue/component-name-in-template-casing": [
"error",
"PascalCase"
]
},
"globals": {
"axios": "readonly"
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"stylelint": {
"rules": {
"no-descending-specificity": null
},
"extends": "stylelint-config-recommended"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
change
RUN npm run build
to
CMD ["npm", "run", "build"]
Related
I am currently using Jest, Husky, Commitizen, and Vuepress. However, when jest tests or the build fails, the commit hook still works. How can I fix this to exit the commitizen hook when things fail? Here is the relevant lines in package.json:
{
"scripts": {
"build": "vuepress build docs
"lint": "eslint --fix --ext .js,.vue docs/.vuepress",
"test": "npm run lint && jest --coverage --coverageDirectory='__coverage__'",
"test:full": "npm run test && npm run build",
"commit": "cz",
...
},
"husky": {
"hooks": {
"prepare-commit-msg": "npm run test:full && exec < /dev/tty && git cz --hook || true"
}
},
"dependencies": {
...
},
"devDependencies": {
"babel-jest": "^26.6.3",
"commitizen": "^4.2.3",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.18.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
...
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Figured it out - it was simple. I needed to add the following to husky:
"husky": {
"hooks": {
"pre-commit": "npm run test:full",
...
}
},
I keep getting this error:
error in ./node_modules/keytar/build/Release/keytar.node
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
# ./node_modules/keytar/lib/keytar.js 1:13-52
# ./src/background.js
# multi ./src/background.js
I have background.js set as the main electron file in package.json because I'm using vue/vuetify with it which uses a main.js file as well.
{
"name": "project",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
},
"main": "background.js", // <------------------ see right here
"dependencies": {
"axios": "^0.19.0",
"core-js": "^3.4.3",
"jwt-decode": "^2.2.0",
"keytar": "^5.0.0",
"request": "^2.88.0",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuetify": "^2.1.0",
"vuex": "^3.1.2"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^4.1.0",
"#vue/cli-plugin-eslint": "^4.1.0",
"#vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"electron": "^7.1.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"node-loader": "^0.6.0",
"sass": "^1.19.0",
"sass-loader": "^8.0.0",
"vue-cli-plugin-electron-builder": "^1.4.3",
"vue-cli-plugin-vuetify": "^2.0.2",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.3.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
Searching, it seems this happens when keytar is used in a renderer process. But background.js isn't a renderer process. Or am I missing something? I am completely new to electron.
I needed to mark keytar as external (as mentioned at https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/guide.html#native-modules)
// vue.config.js
module.exports = {
pluginOptions: {
electronBuilder: {
// List native deps here if they don't work
externals: ['keytar']
}
}
}
Once I did that it worked properly.
Run appropriate loader (source).
yarn add node-loader -D
// vue.config.js
configureWebpack: {
devtool: 'source-map',
module: {
rules: [
{ test: /\.node$/, loader: 'node-loader' }
]
}
}
I'm building a new project using Xcode and I get an error
react-native init test
{
"name": "test1",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.9"
},
"devDependencies": {
"#babel/core": "7.4.5",
"#babel/runtime": "7.4.5",
"babel-jest": "24.8.0",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
I got this error
'glog/logging.h' file not found
Try this:
rm -rf ./node_modules && yarn && react-native run-ios
cd node_modules/react-native/third-party/glog-0.3.4 && ../../scripts/ios-configure-glog.sh should do the trick.
You just have to execute the script manually. Might need to sudo.
I am trying to install Angular CLI using Visual Studio 2017 but it throws an exception while running the command.
> .npm [On.Store.UI] install -g #angular/cli
C:\Users\child\AppData\Roaming\npm\ng -> C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
> node-sass#4.5.3 install C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\node-sass
> node scripts/install.js
Cached binary found at C:\Users\child\AppData\Roaming\npm-cache\node-sass\4.5.3\win32-x64-48_binding.node
> node-sass#4.5.3 postinstall C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\node-sass
> node scripts/build.js
Binary found at C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\node-sass\vendor\win32-x64-48\binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pre-gyp#0.6.33 (node_modules\#angular\cli\node_modules\fsevents\node_modules\node-pre-gyp):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\fsevents\node_modules\node-pre-gyp' -> 'C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\fsevents\node_modules\.node-pre-gyp.DELETE'
+ #angular/cli#1.1.1
added 823 packages and updated 1 package in 167.125s
[On.Store.UI] install -g #angular/cli successfully completed
> .npm [On.Store.UI] install -g #angular/cli
C:\Users\child\AppData\Roaming\npm\ng -> C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
> fsevents#1.1.1 install C:\Users\child\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\fsevents
> node install
+ #angular/cli#1.1.1
added 120 packages, removed 1 package and updated 1 package in 83.667s
[On.Store.UI] install -g #angular/cli successfully completed
>
My package json is :
{
"name": "#angular/cli",
"version": "1.1.1",
"description": "CLI tool for Angular",
"main": "packages/#angular/cli/lib/cli/index.js",
"trackingCode": "UA-8594346-19",
"bin": {
"ng": "./bin/ng"
},
"keywords": [],
"scripts": {
"build": "node scripts/run-tool.js publish build",
"test": "npm-run-all -c test:packages test:cli test:deps test:licenses test:messages",
"e2e": "npm run test:e2e",
"e2e:nightly": "node tests/run_e2e.js --nightly",
"test:e2e": "node tests/run_e2e.js",
"test:cli": "node tests/runner",
"test:deps": "node scripts/publish/validate_dependencies.js",
"test:inspect": "node --inspect --debug-brk tests/runner",
"test:licenses": "node scripts/test-licenses.js",
"test:messages": "node scripts/test-commit-messages.js",
"test:packages": "node scripts/run-packages-spec.js",
"eslint": "eslint .",
"tslint": "tslint \"**/*.ts\" -c tslint.json -e \"**/config/schema.d.ts\" -e \"**/tests/**\" -e \"**/blueprints/*/files/**/*.ts\" -e \"node_modules/**\" -e \"tmp/**\" -e \"dist/**\"",
"lint": "npm-run-all -c eslint tslint",
"tool": "node scripts/run-tool.js"
},
"repository": {
"type": "git",
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": ">= 6.9.0",
"npm": ">= 3.0.0"
},
"author": "Angular Authors",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/angular-cli/issues"
},
"homepage": "https://github.com/angular/angular-cli",
"dependencies": {
"autoprefixer": "^6.5.3",
"chalk": "^1.1.3",
"common-tags": "^1.3.1",
"css-loader": "^0.28.1",
"cssnano": "^3.10.0",
"debug": "^2.1.3",
"denodeify": "^1.2.1",
"diff": "^3.1.0",
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-string-utils": "^1.0.0",
"enhanced-resolve": "^3.1.0",
"exports-loader": "^0.6.3",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.10.0",
"fs-extra": "~3.0.1",
"get-caller-file": "^1.0.0",
"glob": "^7.0.3",
"html-webpack-plugin": "^2.19.0",
"inflection": "^1.7.0",
"inquirer": "^3.0.0",
"isbinaryfile": "^3.0.0",
"istanbul-instrumenter-loader": "^2.0.0",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^4.0.2",
"loader-utils": "^1.0.2",
"license-webpack-plugin": "^0.4.3",
"lodash": "^4.11.1",
"magic-string": "^0.19.0",
"memory-fs": "^0.4.1",
"minimatch": "^3.0.3",
"node-modules-path": "^1.0.0",
"nopt": "^4.0.1",
"opn": "4.0.2",
"portfinder": "~1.0.12",
"postcss-loader": "^1.3.3",
"postcss-url": "^5.1.2",
"raw-loader": "^0.5.1",
"resolve": "^1.1.7",
"rimraf": "^2.5.3",
"rsvp": "^3.0.17",
"rxjs": "^5.0.1",
"sass-loader": "^6.0.3",
"script-loader": "^0.7.0",
"semver": "^5.3.0",
"silent-error": "^1.0.0",
"source-map": "^0.5.6",
"source-map-loader": "^0.2.0",
"style-loader": "^0.13.1",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"temp": "0.8.3",
"typescript": "~2.3.1",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~2.4.0",
"webpack-dev-middleware": "^1.10.2",
"webpack-dev-server": "~2.4.5",
"webpack-merge": "^2.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#angular/compiler": "^4.0.0",
"#angular/compiler-cli": "^4.0.0",
"#angular/core": "^4.0.0",
"#types/chai": "^3.4.32",
"#types/chalk": "^0.4.28",
"#types/common-tags": "^1.2.4",
"#types/denodeify": "^1.2.29",
"#types/express": "^4.0.32",
"#types/fs-extra": "~3.0.2",
"#types/glob": "^5.0.29",
"#types/jasmine": "~2.2.0",
"#types/lodash": "4.14.50",
"#types/minimist": "^1.2.0",
"#types/mock-fs": "^3.6.30",
"#types/node": "^6.0.36",
"#types/request": "0.0.39",
"#types/rimraf": "0.0.28",
"#types/semver": "^5.3.30",
"#types/source-map": "^0.5.0",
"#types/webpack": "^2.2.15",
"chai": "^3.5.0",
"conventional-changelog": "^1.1.0",
"dtsgenerator": "^0.9.1",
"eslint": "^3.11.0",
"express": "^4.14.0",
"jasmine": "^2.4.1",
"jasmine-spec-reporter": "^3.2.0",
"minimist": "^1.2.0",
"mocha": "^3.2.0",
"mock-fs": "^4.0.0",
"npm-run": "^4.1.0",
"npm-run-all": "^4.0.0",
"object-assign": "^4.0.1",
"request": "^2.74.0",
"resolve-bin": "^0.4.0",
"rewire": "^2.5.1",
"spdx-satisfies": "^0.1.3",
"through": "^2.3.6",
"tree-kill": "^1.0.0",
"ts-node": "^2.0.0",
"tslint": "^5.1.0"
},
"optionalDependencies": {
"node-sass": "^4.3.0"
}
}
=======tsConfig.js
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"compileOnSave": true,
"exclude": [
"node_modules"
]
}
my visual code compiler errors are mentioned below :
Severity Code Description Project File Line Suppression State
Error TS2304 Cannot find name 'Promise'. On.Store.UI (tsconfig project) L:\ESaleStore\On.Store.UI\src\On.Store.UI\node_modules\#angular\common\src\location\platform_location.d.ts 51 Active
Error TS2304 Cannot find name 'Promise'. On.Store.UI (tsconfig project) L:\ESaleStore\On.Store.UI\src\On.Store.UI\node_modules\#angular\common\src\location\platform_location.d.ts 51 Active
Error TS2304 Cannot find name 'Promise'. On.Store.UI (tsconfig project) L:\ESaleStore\On.Store.UI\src\On.Store.UI\node_modules\#angular\common\src\pipes\async_pipe.d.ts 45 Active
Error TS2304 Cannot find name 'Promise'. On.Store.UI (tsconfig project) L:\ESaleStore\On.Store.UI\src\On.Store.UI\node_modules\#angular\compiler\src\aot\compiler_host.d.ts 25 Active
Error TS2339 Property 'find' does not exist on type 'BillingPackage[]'. On.Store.UI (tsconfig project) L:\ESaleStore\On.Store.UI\src\On.Store.UI\wwwroot\app\Billing\Billing.Service.ts 27 Active
I'm trying to setup codecov as code coverage tool in a repository. However, it is passing Travis CI test but not showing codecov report. Here is link of travis report - https://travis-ci.org/fossasia/susper.com/builds/213793203 (see under bash <(curl -s https://codecov.io/bash)). What should I do?
Here is the source code -
package.json
{
"name": "susper",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "2.4.0",
"#angular/compiler": "2.4.0",
"#angular/core": "2.4.0",
"#angular/forms": "2.4.0",
"#angular/http": "2.4.0",
"#angular/platform-browser": "2.4.0",
"#angular/platform-browser-dynamic": "2.4.0",
"#angular/router": "3.4.0",
"#ngrx/core": "^1.2.0",
"#ngrx/effects": "^2.0.0",
"#ngrx/router-store": "^1.2.5",
"#ngrx/store": "^2.2.1",
"#ngrx/store-devtools": "^3.2.3",
"core-js": "^2.4.1",
"ngrx-store-freeze": "^0.1.6",
"reselect": "^2.5.4",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"#angular/compiler-cli": "2.4.0",
"#types/jasmine": "2.5.38",
"#types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.24",
+ "codecov.io": "^0.1.6",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
- "karma": "1.2.0",
+ "karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
+ "karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}
}
travis.yml
sudo: required
dist: trusty
language: node_js
node_js:
- 6
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
+- pip install --user codecov
before_script:
- ng build
script:
- ng lint
- >
docker run -ti -v $(pwd):/app --workdir=/app coala/base coala --version
after_success:
- bash ./deploy.sh
+- bash <(curl -s https://codecov.io/bash)
cache:
bundler: true
directories:
- node_modules
- .coala-cache
services: docker
branches:
only:
- angular
karma.conf.js
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-remap-istanbul'),
- require('angular-cli/plugins/karma')
+ require('angular-cli/plugins/karma'),
+ require('karma-coverage')
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
- './src/test.ts': ['angular-cli']
+ './src/test.ts': ['angular-cli'],
+ 'src/app/**/*.js': ['coverage']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
+ coverageReporter: {
+ type : 'lcov',
+ dir : 'coverage/'
+ },
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'karma-remap-istanbul']
- : ['progress'],
+ : ['progress', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
tsconfig.json
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/#types"
]
}
}
Happy to help out!
Issue: No reports are generated. See https://travis-ci.org/fossasia/susper.com/builds/213793203#L390
Suggestions
You do not need to use the bash uploader and the node uploader in the same project. So you may choose one or the other. Nonetheless, you have configured Codecov properly.
Using Docker: http://docs.codecov.io/docs/testing-with-docker
I did not dive deep into your project, but I suspect the reports are within the docker container and need to be passed through to Travis.