Translate

2018년 2월 26일 월요일

[Javascript] IE 에서 'includes' 속성이나 메서드를 지원하지 않습니다. 오류






환경
 - JHipster 4.13.1 (Spring Boot + Angular 5)




Internet Explorer 11 (IE11) 에서 아래와 같은 오류가 발생했다.
1004lucifer





아래와 같이 polyfill 을 추가하여 하여 이슈를 해결했다.

import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es7/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';





PS.
아래와 같은 다른 방법도 있다.
1004lucifer
1. JavaScript 에서 직접 include 함수를 사용한경우
 - indexOf를 대신 사용 (http://aramk.tistory.com/28)

2. npm / yarn 을 사용하는 경우 polyfill 라이브러리를 추가하면 된다.
 - https://www.npmjs.com/package/array.prototype.includes




참고
 - https://github.com/jhipster/generator-jhipster/issues/6953

2018년 2월 19일 월요일

[Angular 2+] Can't resolve './app.module.ngfactory' 오류






개발환경
 - JHipster 4.13.1 (Spring Boot + Angular 5)





문제

 - Prod (AOT) 빌드 시 아래와 같은 에러가 발생한다.
  (yarn serve | ng serve 와 같은 명령어는 에러가 발생하지 않는다.)
1004lucifer
1. 일반 빌드
 (node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack/webpack.prod.js --progress --profile)



ERROR in ./src/main/webapp/app/app.main.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app'
 @ ./src/main/webapp/app/app.main.ts 2:0-62





2. 디버그 모드 빌드
 (node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack/webpack.prod.js --progress --profile --debug --verbose)



ERROR in ./src/main/webapp/app/app.main.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app'
resolve './app.module.ngfactory' in 'C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app'
  using description file: C:\Users\1004lucifer\IdeaProjects\project\package.json (relative path: ./src/main/webapp/app)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: C:\Users\1004lucifer\IdeaProjects\project\package.json (relative path: ./src/main/webapp/app)
    using description file: C:\Users\1004lucifer\IdeaProjects\project\package.json (relative path: ./src/main/webapp/app/app.module.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory.js doesn't exist
      as directory
        C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory doesn't exist
[C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory]
[C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory.ts]
[C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory.js]
[C:\Users\1004lucifer\IdeaProjects\project\src\main\webapp\app\app.module.ngfactory]
 @ ./src/main/webapp/app/app.main.ts 2:0-62










원인

 - 사용하지 않는 Component 또는 파일이 있는경우 ngfactory Error 가 발생할 수 있다.








해결방법
1004lucifer
 - 사용하지 않는 Component를 찾아 삭제 후 빌드하니 정상적으로 작동했다.







PS.
어떤 Component가 사용하지 않는지 찾는게 정말 힘들었는데..

나의 경우에는 아래와 같이 git checkout HEAD~[_NUM_] 명령어를 이용해 정상적으로 빌드가 되었던 상황을 찾아 추가/삭제된 파일을 비교하여 찾았다.

1. git checkout HEAD~1
2. yarn build
3. git checkout HEAD~1
4. yarn build
5. ...



아래의 참고 링크에도 나와있듯이 이런 경우에는 warning 을 기대했는데..
이렇게 에러가 나면서 빌드가 되지 않는것은 이해하기 힘들다.

(게다가 어느파일이 사용되지 않는지 알려주지 않아 디버깅 하기가 너무 힘들다.
며칠동안 이것저것 시도를 해봤는데 결국에 문제의 파일을 찾을 수 있게 로그를 나오게 하는 방법은 알 수 없었다.)



참고
 - https://github.com/angular/angular-cli/issues/3636
 - https://github.com/angular/angular/issues/13590


2018년 2월 12일 월요일

[Angular 2+] ng 명령어 실행 시 Error: Cannot find module '@angular-devkit/core' 에러





ng 명령어 실행 시 아래와 같은 오류가 발생했다.


1004lucifer

Your global Angular CLI version (1.6.8) is greater than your local
version (1.6.0). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
module.js:540
    throw err;
    ^

Error: Cannot find module '@angular-devkit/core'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\1004lucifer\IdeaProjects\[_PROJECT_]\node_modules\@angular-devkit\schematics\src\tree\virtual.js:10:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)









아래와 같이 해결을 했다.

package.json


"devDependencies": {
    "@angular/cli": "1.6.0",   =>   "@angular/cli": "^1.6.0",
  ...



command
1004lucifer

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>yarn install
yarn install v1.3.2
[1/5] Validating package.json...
[2/5] Resolving packages...
warning Resolution field "uglify-es@3.2.2" is incompatible with requested version "uglify-es@^3.3.4"
[3/5] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
$ node node_modules/phantomjs-prebuilt/install.js
Found PhantomJS at C:\Users\1004lucifer\IdeaProjects\PROJECT\admin\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe ...verifying
PhantomJS is previously installed at C:\Users\1004lucifer\IdeaProjects\PROJECT\admin\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe
Done in 53.49s.

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>ng -version
The specified command -version is invalid. For available options, see `ng help`.

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>
C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.8
Node: 8.9.4
OS: win32 x64
Angular: 5.1.0
... common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, router

@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.5
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack-dev-server: 2.9.5
webpack-merge: 4.1.1
webpack-notifier: 1.5.0
webpack-visualizer-plugin: 0.1.11
webpack: 3.10.0

C:\Users\1004lucifer\IdeaProjects\PROJECT\admin>




참고
https://github.com/angular/angular-cli/issues/9307


[Webpack] jQuery Plugin 추가 시 'Cannot read property 'fn' of undefined' 에러






개발환경 - JHipster: 4.13.1 (Spring Boot + Angular 5)





bootstrap-wysiwyg jQuery Plugin 설치 시 아래와 같은 에러가 발생했다.




Uncaught TypeError: Cannot read property 'fn' of undefined
    at eval (webpack-internal:///./node_modules/bootstrap-wysiwyg/src/bootstrap-wysiwyg.js:329)
    at eval (webpack-internal:///./node_modules/bootstrap-wysiwyg/src/bootstrap-wysiwyg.js:333)
    at Object../node_modules/bootstrap-wysiwyg/src/bootstrap-wysiwyg.js (vendor.bundle.js:798)
    at __webpack_require__ (manifest.bundle.js:713)
    at fn (manifest.bundle.js:118)
    at Object.eval (webpack-internal:///./src/main/webapp/app/service-operation/app/app-version-detail.component.ts:15)
    at eval (webpack-internal:///./src/main/webapp/app/service-operation/app/app-version-detail.component.ts:235)
    at Object../src/main/webapp/app/service-operation/app/app-version-detail.component.ts (main.bundle.js:438)
    at __webpack_require__ (manifest.bundle.js:713)
    at fn (manifest.bundle.js:118)







해경방법
1004lucifer
webpack 설정을 아래와 같이 변경하여 이슈를 해결하였다.
(참고 - https://webpack.js.org/plugins/provide-plugin/)

const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const rxPaths = require('rxjs/_esm5/path-mapping');
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");

const utils = require('./utils.js');

module.exports = (options) => ({
    resolve: {
        extensions: ['.ts', '.js'],
        modules: ['node_modules'],
        alias: rxPaths()
    },
    stats: {
        children: false
    },
    module: {
        rules: [
            { test: /bootstrap\/dist\/js\/umd\//, loader: 'imports-loader?jQuery=jquery' },
            {
                test: /\.html$/,
                loader: 'html-loader',
                options: {
                    minimize: true,
                    caseSensitive: true,
                    removeAttributeQuotes:false,
                    minifyJS:false,
                    minifyCSS:false
                },
                exclude: ['./src/main/webapp/index.html']
            },
            {
                test: /\.(jpe?g|png|gif|svg|woff2?|ttf|eot)$/i,
                loaders: ['file-loader?hash=sha512&digest=hex&name=content/[hash].[ext]']
            },
            {
                test: /manifest.webapp$/,
                loader: 'file-loader?name=manifest.webapp!web-app-manifest-loader'
            }
        ]
    },
    plugins: [
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: `'${options.env}'`,
                VERSION: `'${utils.parseVersion()}'`,
                DEBUG_INFO_ENABLED: options.env === 'development',
                // The root URL for API calls, ending with a '/' - for example: `"http://www.jhipster.tech:8081/myservice/"`.
                // If this URL is left empty (""), then it will be relative to the current context.
                // If you use an API server, in `prod` mode, you will need to enable CORS
                // (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations)
                SERVER_API_URL: `''`
            }
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'polyfills',
            chunks: ['polyfills']
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'vendor',
            chunks: ['main'],
            minChunks: module => utils.isExternalLib(module)
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: ['polyfills', 'vendor'].reverse()
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: ['manifest'],
            minChunks: Infinity,
        }),
        /**
         * See: https://github.com/angular/angular/issues/11580
         */
        new webpack.ContextReplacementPlugin(
            /(.+)?angular(\\|\/)core(.+)?/,
            utils.root('src/main/webapp/app'), {}
        ),
        new CopyWebpackPlugin([
            { from: './node_modules/swagger-ui/dist/css', to: 'swagger-ui/dist/css' },
            { from: './node_modules/swagger-ui/dist/lib', to: 'swagger-ui/dist/lib' },
            { from: './node_modules/swagger-ui/dist/swagger-ui.min.js', to: 'swagger-ui/dist/swagger-ui.min.js' },
            { from: './src/main/webapp/swagger-ui/', to: 'swagger-ui' },
            { from: './src/main/webapp/favicon.png', to: 'favicon.png' },
            { from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' },
            // jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array
            { from: './src/main/webapp/robots.txt', to: 'robots.txt' }
        ]),
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery",
            'window.jQuery': "jquery"
        }),
        new MergeJsonWebpackPlugin({
            output: {
                groupBy: [
                    { pattern: "./src/main/webapp/i18n/ko/*.json", fileName: "./i18n/ko.json" },
                    { pattern: "./src/main/webapp/i18n/en/*.json", fileName: "./i18n/en.json" }
                    // jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array
                ]
            }
        }),
        new HtmlWebpackPlugin({
            template: './src/main/webapp/index.html',
            chunksSortMode: 'dependency',
            inject: 'body'
        })
    ]
});








원인


일반적인 jQuery Plugin 의 경우에는 아래와 같다.

node_modules/bootstrap/dist/js/bootstrap.js
/*!
 * Bootstrap v3.3.7 (http://getbootstrap.com)
 * Copyright 2011-2016 Twitter, Inc.
 * Licensed under the MIT license
 */

 ...
 
+function ($) {
  'use strict';

  ...

  $(window).on('load', function () {
    $('[data-spy="affix"]').each(function () {
      var $spy = $(this)
      var data = $spy.data()

      data.offset = data.offset || {}

      if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
      if (data.offsetTop    != null) data.offset.top    = data.offsetTop

      Plugin.call($spy, data)
    })
  })

}(jQuery);




Error 가 발생한 jQuery Plugin 의 소스는 아래와 같았다.
1004lucifer
node_modules/bootstrap-wysiwyg/src/bootstrap-wysiwyg.js
/* jshint browser: true */

( function( window, $ )
{
    "use strict";

 ...

     $.fn.wysiwyg = function( userOptions ) {
        var wysiwyg = new Wysiwyg( this, userOptions );
     };

} )( window, window.jQuery );





사용하려는 jQuery Plugin 이 예전형식의 jQuery Load 형식을 취해서 오류가 발생을 했었다.
jQuery Plugin 소스를 열어보지 않았다면 알 수 없었을 상황..ㅠ
한참동안 삽질하다 겨우 찾았다.


2018년 2월 9일 금요일

[Angular 2+] Input Tag date 타입에서 ngModel 사용하기





실습환경: Angular 5



Input 태그에서 type="date" 를 사용 시 ngModel 로 date 객체가 들어가지 않아 아래와 같이 처리를 했다.



test.component.ts
export class TestComponent implements OnInit {

    dateObject: string;

    constructor(
    ) {
    }

    ngOnInit() {
    }
 
 ...
}

1004lucifer

test.component.html
<input type="date"
        [ngModel]="dateObject | date:'yyyy-MM-dd'"
        (ngModelChange)="dateObject = $event" />



2018년 2월 6일 화요일

[Angular 2+] SubMenu 상황의 routerLinkActive 사용





개발환경: Angular 4




Angular 에서 링크를 사용할 때 아래의 속성을 사용한다.

 - routerLink: 이동하려는 URL 지정
 - routerLinkActive: 해당 URL 이동 시 class에 해당 값 넣어줌




이슈가 발생한 경우는 서브메뉴를 처리해야 하는 경우에 발생을 했다.
메인메뉴와 서브메뉴 둘다 routerLinkActive 속성이 발동이 되어야 했다.



아래와 같이 router path 설정 시 redirectTo 속성을 이용하여 2개의 URL에 매칭되는 routerLink 를 만들어 해결을 했다.




Main Menu
<ul class="manage_tab">
    <li routerLink="/admin/user-management" routerLinkActive="on">사용자 관리</li>
    <li routerLink="/admin/equipment-management" routerLinkActive="on"><a routerLink="/admin/equipment-management/one">설비 관리</a></li>
    <li routerLink="/admin/alarm-setting" routerLinkActive="on">알람 설정</li>
</ul>


1004lucifer


Sub Menu
<div class="facil_tab">
    <ul>
        <li routerLink="/admin/equipment-management/one" routerLinkActive="on"><a>ONE</a></li>
        <li>|</li>
        <li routerLink="/admin/equipment-management/two" routerLinkActive="on"><a>TWO</a></li>
        <li>|</li>
        <li routerLink="/admin/equipment-management/three" routerLinkActive="on"><a>THREE</a></li>
        <li>|</li>
        <li routerLink="/admin/equipment-management/four" routerLinkActive="on"><a>FOUR</a></li>
    </ul>
</div>




1004lucifer
route 설정
export const adminState: Routes = [
    {
        path: 'admin',
        data: {
            authorities: ['ROLE_ADMIN']
        },
        children: [
            {
                path: 'user-management',
                component: UserManagementComponent,
                resolve: {
                    'pagingParams': StandardResolvePagingParams
                },
                data: {
                    pageTitle: 'title.admin.userManagement'
                },
                canActivate: [UserRouteAccessService],
            },
            {
                path: 'equipment-management',
                children: [
                    {
                        path: '',
                        redirectTo: 'one',
                        pathMatch: 'full',
                    },
                    {
                        path: 'one',
                        component: OneManagementComponent,
                        resolve: {
                            'pagingParams': StandardResolvePagingParams
                        },
                        data: {
                            pageTitle: 'title.admin.equipmentManagement.one'
                        },
                        canActivate: [UserRouteAccessService],
                    },
                    {
                        path: 'two',
                        component: TwoManagementComponent,
                        resolve: {
                            'pagingParams': StandardResolvePagingParams
                        },
                        data: {
                            pageTitle: 'title.admin.equipmentManagement.two'
                        },
                        canActivate: [UserRouteAccessService],
                    },
     ...
                ]
            }
        ]
    }
];

서브메뉴, 메뉴

[Windows] 윈도우 10 설치 시 디스크 인식오류(Windows를 설치할 위치를 지정하세요)






Windows 10 설치 중 아래와 같은 화면이 보여지며 디스크를 선택할 수 없는 상황이 발생했다.
(CMOS 에서는 정상적으로 인식이 되어 디스크에 문제가 있는 것은 아니었다.)

'Windows를 설치할 위치를 지정하세요' 멘트가 보여지며 디스크(하드) 인식이 되지 않았다.
1004lucifer





인터넷에서 찾아서 이것저것 해봤는데..

원인은 정말 단순하게도..
Windows 10 에서 해당 메인보드의 칩셋 드라이버가 없어서 디스크를 인식 할 수 없었던 것이다.



나는 아래의 메인보드를 사용했었는데..
TYAN - thunder h2000m s3992
1004lucifer
인터넷에서 해당 보드의 칩셋 드라이버를 다운받아 Windows 10 설치 USB에 같이 넣어서 화면의 '드라이버 로드' 버튼을 클릭하여 칩셋 드라이버를 선택하니 바로 디스크가 보여졌다.



만일 Windows 설치 시 캡쳐화면과 같이 보여지게 되는경우 우선적으로 메인보드 칩셋 드라이버를 로드 하는것을 권장한다.


2018년 2월 3일 토요일

[COIN] 채굴 풀 메시지 - stratum_recv_line failed







cpuminer 를 이용해 채굴풀에 접속하여 채굴하려 했는데 아래와 같은 메시지가 나오며 정상적으로 동작하지 않았다.
1004lucifer


C:\Users\1004lucifer\Downloads\cpuminer-opt-3.8.0-windows>cpuminer-aes-sse42.exe -a [algo] -o stratum+tcp://[hostname]:[port] -u [username]

         **********  cpuminer-opt 3.8.0  ***********
     A CPU miner with multi algo support and optimized for CPUs
     with AES_NI and AVX2 and SHA extensions.
     BTC donation address: 12tdvfF7KmAsihBXQXynT6E6th2c2pByTT

CPU: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz.
SW built on Jan 23 2018 with GCC 5.3.1.
CPU features: SSE2 AES AVX AVX2.
SW features: SSE2 AES.
Algo features: None.
Start mining with no optimizations.

[2018-02-03 11:25:53] 4 miner threads started, using '[algo]' algorithm.
[2018-02-03 11:25:53] Starting Stratum on stratum+tcp://[hostname]:[port]
[2018-02-03 11:25:53] stratum_recv_line failed
[2018-02-03 11:25:53] ...retry after 10 seconds
[2018-02-03 11:26:03] stratum_recv_line failed
[2018-02-03 11:26:03] ...retry after 10 seconds
[2018-02-03 11:26:04] CTRL_C_EVENT received, exiting

C:\Users\1004lucifer\Downloads\cpuminer-opt-3.8.0-windows>







원인
1004lucifer
채굴풀(마이닝풀) 에서 Coin Daemon 으로부터 정상적인 stratum 메시지를 수신받지 못했다.
대부분의 경우 채굴풀에 문제가 있는 경우이며 다른 채굴풀에 접속하여 정상적으로 되는지 여부를 확인해 보는게 빠르다.

나의 경우에는 채굴풀 구축 시 채굴풀(NOMP)과 Coin Daemon 연결이 제대로 되지 않아 문제가 되었던 부분이었다.




[NOMP] Log - No new blocks for 55 seconds







NOMP 설치 후 운영 시 아래와 같은 로그가 나오며..
채굴풀 클라이언트에서 해시 찾는것을 종료하고 다시 찾는 것과 같은 로그가 보여진다.
1004lucifer



2018-02-03 13:58:27 [Pool]      [htmlcoin] (Thread 3) Block notification via RPC polling
2018-02-03 13:58:31 [Pool]      [htmlcoin] (Thread 4) Block notification via RPC polling
2018-02-03 13:58:31 [Pool]      [htmlcoin] (Thread 1) Block notification via RPC polling
2018-02-03 13:58:32 [Pool]      [htmlcoin] (Thread 2) Block notification via RPC polling
2018-02-03 13:58:32 [Pool]      [htmlcoin] (Thread 3) Block notification via RPC polling
2018-02-03 13:58:45 [Payments]  [htmlcoin] Finished interval - time spent: 2ms total, 1ms redis, 2ms daemon                            RPC
2018-02-03 13:59:05 [Payments]  [htmlcoin] Finished interval - time spent: 2ms total, 0ms redis, 1ms daemon                            RPC
2018-02-03 13:59:25 [Payments]  [htmlcoin] Finished interval - time spent: 1ms total, 0ms redis, 1ms daemon                            RPC
2018-02-03 13:59:26 [Pool]      [htmlcoin] (Thread 4) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 13:59:26 [Pool]      [htmlcoin] (Thread 1) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 13:59:27 [Pool]      [htmlcoin] (Thread 2) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 13:59:27 [Pool]      [htmlcoin] (Thread 3) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 13:59:45 [Payments]  [htmlcoin] Finished interval - time spent: 2ms total, 0ms redis, 1ms daemon                            RPC
2018-02-03 14:00:05 [Payments]  [htmlcoin] Finished interval - time spent: 2ms total, 1ms redis, 2ms daemon                            RPC
2018-02-03 14:00:21 [Pool]      [htmlcoin] (Thread 4) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 14:00:21 [Pool]      [htmlcoin] (Thread 1) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 14:00:22 [Pool]      [htmlcoin] (Thread 2) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 14:00:22 [Pool]      [htmlcoin] (Thread 3) No new blocks for 55 seconds - updating transactions &                            rebroadcasting work
2018-02-03 14:00:25 [Payments]  [htmlcoin] Finished interval - time spent: 3ms total, 1ms redis, 3ms daemon                            RPC








원인 및 해결방법

config.json 파일의 connectionTimeout 속성에 클라이언트 timeout 시간(초)을 늘려주면 된다.
1004lucifer

root@ubuntu:~/nomp# cat config.json
{
    "logLevel": "debug",
    "logColors": true,

    "cliPort": 17117,

    "clustering": {
        "enabled": true,
        "forks": "auto"
    },

    "defaultPoolConfigs": {
        "blockRefreshInterval": 1000,
        "jobRebroadcastTimeout": 300,
        "connectionTimeout": 600,
        "emitInvalidBlockHashes": false,
        "validateWorkerUsername": true,
        "tcpProxyProtocol": false,
        "banning": {
            "enabled": true,
            "time": 600,
            "invalidPercent": 50,
            "checkThreshold": 500,
            "purgeInterval": 300
        },
        "redis": {
            "host": "127.0.0.1",
            "port": 6379
        }
    },






참고
 - https://github.com/UNOMP/unified-node-open-mining-portal/issues/113


[NOMP] Error - Daemon does not own pool address








NOMP 셋팅 후 기동을 시키니 아래의 초록색 로그가 발생을 했다.

1004lucifer

root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# node init.js
2018-02-03 13:49:38 [POSIX]     [Connection Limit] (Safe to ignore) POSIX module not installed and resource (connection) limit was not raised
2018-02-03 13:49:38 [Master]    [CLI] CLI listening on port 17117
2018-02-03 13:49:39 [Payments]  [coin] Daemon does not own pool address - payment processing can not be done with this daemon, {"isvalid":true,"address":"Hsdfsafasf68sa4f6as5f4as6f51kk","scriptPubKey":"76a91sadf6asd5f4asd3fas5d4fas6d8f4sadfae4ee67fbfa788ac","ismine":false,"iswatchonly":false,"isscript":false}
2018-02-03 13:49:39 [Master]    [PoolSpawner] Spawned 1 pool(s) on 4 thread(s)
2018-02-03 13:49:39 [Website]   [Server] Website started on 0.0.0.0:80
2018-02-03 13:49:39 [Website]   [coin] Could not dumpprivkey for coin {"code":-4,"message":"Private key for address HXsajgtz6m7NzjiktUCqpKbVgHjdVE7Ekk is not known"}
2018-02-03 13:49:39 [Switching] [Setup] (Thread 1) Loading last proxy state from redis
2018-02-03 13:49:39 [Pool]      [coin] (Thread 1) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 13:49:39 [Pool]      [coin] (Thread 1) The address provided is not from the daemon wallet - this is required for POS coins.
(node-watch) First param in callback function  is replaced with event name since 0.5.0, use  `(evt, filename) => {}` if you want to get the filename
2018-02-03 13:49:40 [Switching] [Setup] (Thread 2) Loading last proxy state from redis
2018-02-03 13:49:40 [Pool]      [coin] (Thread 2) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 13:49:40 [Pool]      [coin] (Thread 2) The address provided is not from the daemon wallet - this is required for POS coins.
2018-02-03 13:49:40 [Switching] [Setup] (Thread 3) Loading last proxy state from redis
2018-02-03 13:49:40 [Pool]      [coin] (Thread 3) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 13:49:40 [Pool]      [coin] (Thread 3) The address provided is not from the daemon wallet - this is required for POS coins.
2018-02-03 13:49:40 [Switching] [Setup] (Thread 4) Loading last proxy state from redis
2018-02-03 13:49:40 [Pool]      [coin] (Thread 4) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 13:49:40 [Pool]      [coin] (Thread 4) The address provided is not from the daemon wallet - this is required for POS coins.








원인


root@ubuntu:~/nomp#
root@ubuntu:~/nomp# cat pool_configs/coinname.json
{
    "enabled": true,
    "coin": "coinname.json",

    "address": "HXsaasdf6as5d4fa6s8df4sadfVE7Ekk",

    "rewardRecipients": {
        "HXsaasdf6as5d4fa6s8df4sadfVE7Ekk": 100
    },


1004lucifer
pool_configs/coinname.json 파일에 설정한 address 가
Coin Daemon 설치된 곳의 지갑 wallet.dat 파일의 private key 와 맞지 않아서 문제가 된 것이다.
(해당 주소로 코인을 획득하면 Coin Daemon 을 이용하여 코인을 다른 주소로 배분을 해야 하기 때문에..)




해결방법
1004lucifer
Coin Daemon 에서 사용하고 있는 wallet.dat 파일을 address 에 설정한 주소의 실제 지갑 파일로 교체를 하거나 wallet.dat 파일에서 신규 address를 추출하여
pool_configs/coinname.json 파일의 address 항목에 입력하면 된다.



참고
 - https://github.com/z-classic/z-nomp/issues/202

[NOMP] Error - Module did not self-register







NOMP 설치 후 기동 시 Module did not self-register 에러 발생 시 조치 방법

1004lucifer

root@ubuntu:~/nomp#
root@ubuntu:~/nomp# node init.js
module.js:435
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:435:18)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/root/nomp/node_modules/stratum-pool/node_modules/bignum/index.js:4:11)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# nvm list
    v0.10.25
->    system
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# nvm use 0.10.25
Now using node v0.10.25
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# node init.js
2018-02-03 10:36:01 [POSIX]     [Connection Limit] (Safe to ignore) POSIX module not installed and resource (connection) limit was not raised
2018-02-03 10:36:01 [Master]    [CLI] CLI listening on port 17117
2018-02-03 10:36:02 [Master]    [PoolSpawner] Spawned 1 pool(s) on 4 thread(s)
2018-02-03 10:36:02 [Switching] [Setup] (Thread 1) Loading last proxy state from redis
2018-02-03 10:36:02 [Pool]      [htmlcoin] (Thread 1) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 10:36:02 [Pool]      [htmlcoin] (Thread 1) Could not start pool, error with init batch RPC call: {"type":"offline","message":"connect ECONNREFUSED"}
(node-watch) First param in callback function  is replaced with event name since 0.5.0, use  `(evt, filename) => {}` if you want to get the filename
2018-02-03 10:36:03 [Website]   [Server] Website started on 0.0.0.0:80
2018-02-03 10:36:03 [Website]   [htmlcoin] Could not dumpprivkey for htmlcoin {"type":"offline","message":"connect ECONNREFUSED"}
2018-02-03 10:36:03 [Switching] [Setup] (Thread 2) Loading last proxy state from redis
2018-02-03 10:36:03 [Pool]      [htmlcoin] (Thread 2) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 10:36:03 [Pool]      [htmlcoin] (Thread 2) Could not start pool, error with init batch RPC call: {"type":"offline","message":"connect ECONNREFUSED"}
2018-02-03 10:36:03 [Switching] [Setup] (Thread 3) Loading last proxy state from redis
2018-02-03 10:36:03 [Pool]      [htmlcoin] (Thread 3) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 10:36:03 [Pool]      [htmlcoin] (Thread 3) Could not start pool, error with init batch RPC call: {"type":"offline","message":"connect ECONNREFUSED"}
2018-02-03 10:36:03 [Switching] [Setup] (Thread 4) Loading last proxy state from redis
2018-02-03 10:36:03 [Pool]      [htmlcoin] (Thread 4) Share processing setup with redis (127.0.0.1:6379)
2018-02-03 10:36:03 [Pool]      [htmlcoin] (Thread 4) Could not start pool, error with init batch RPC call: {"type":"offline","message":"connect ECONNREFUSED"}







NOMP 공식 문서에서 node 10+ 버전을 사용하라고 되어있다.

https://github.com/zone117x/node-open-mining-portal#requirements
1004lucifer



[NOMP] Error - SyntaxError: Use of const in strict mode






NOMP 설치 중 아래와 같이 오류가 발생하는 경우
https://github.com/zone117x/node-open-mining-portal/issues/512
1004lucifer

/home/pool/nomp/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/pool/nomp/node_modules/request/node_modules/hawk/lib/index.js:5:33)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)



아래와 같이 packaage.json 파일의 request 항목을 수정 후 다시 작업한다.

 # vi package.json
 "request": "*", => "request": "2.69.0",

 # npm update
 # node init.js




[COIN][HTML] Error - CreateNewBlock: TestBlockValidity Failed: bad-version (code 17)







HTMLCOIN 채굴 시 드믈게 보일 수 있는 부분이며, 한번도 보지 못할 수도 있지만..
아래와 같은 화면을 볼 수도 있다.






커뮤니티에서 왜 채굴이 안되는지 종종 문의가 올라오는데 잠시 후 다시 채굴명령어 수행하면 정상적으로 된다.







저 메시지가 뜨는 정확한 원인에 대해서 확인을 해보기 위해 소스를 확인해 보기로 했다.


[https://github.com/HTMLCOIN/HTMLCOIN/blob/master/src/miner.cpp]

1. 채굴 진행 전 블록 생성 부분 (CreateNewBlock)

1004lucifer
 - 296: 블록의 유효성을 검증한다.





[https://github.com/HTMLCOIN/HTMLCOIN/blob/master/src/validation.cpp]

2. 블록 유효성 검증 부분 (TestBlockValidity)


 - 4531: 블록를 체크한다.



3. 블록 체크 부분 (ContextualCheckBlock)


 - 4232: 블록 동기화를 체크한다.






결론

결국 블록이 정상적으로 동기화 되지 않은경우 bad-version 관련 에러가 나타나게 된다.



다시한번 캡쳐모습을 보면

1. 01시 15분 까지 채굴이 되고있다가 절전보드가 되었던.. 노트북 화면을 닫았던 컴퓨터가 사용하지 못하는 상태가 되어 동기화가 안되고 있는 상황에서

2. 05시 05분 다시 컴퓨터가 다시 사용 가능한 상태로 되어 동기화가 완벽히 이루어지지 않은 상태에서 먼저 입력했었던 채굴명령어가 순차적으로 돌면서 에러가 발생한 것으로 보인다.








내 피씨에서도 로그를 확인해보니 아래와 같이 bad-version 로그를 확인 할 수 있었다.
(00시 25분 부터 01:05분 까지 동기화가 이뤄지지 않은 상태에서 지갑은 동기화를 수행중이며, 해당 시간에 채굴명령어가 돌아서 bad-version 에러가 발생을 했다.)
1004lucifer

2018-01-26 00:22:14 ProcessSyncCheckpoint: sync-checkpoint at 431fddebe966d693261ce4470915b7ca2f88d3316611bdc8ca801b72163af489
2018-01-26 00:22:14 ProcessMessage: hashCheckpoint=431fddebe966d693261ce4470915b7ca2f88d3316611bdc8ca801b72163af489
2018-01-26 00:22:15 UpdateTip: new best=e5f5e753c09a3802b064dc2cea1da857cb3eec70fb8e7468027456339589642f height=95361 version=0x20000000 log2_work=78.415773 tx=179205 date='2018-01-26 00:22:24' progress=1.566409 cache=3.2MiB(26025txo)
2018-01-26 00:22:15 ProcessNetBlock: ACCEPTED
2018-01-26 00:25:35 UpdateTip: new best=0000000000e3319830508cc00d8b7a5fb964fdb75b2eb5c6687927a99fd2ed09 height=95362 version=0x20000000 log2_work=78.415773 tx=179207 date='2018-01-26 00:25:26' progress=0.734434 cache=3.2MiB(26028txo)
2018-01-26 00:25:35 ProcessNetBlock: ACCEPTED
2018-01-26 00:25:35 ProcessSyncCheckpoint: sync-checkpoint at 00000000016a6e54262b21665e97422db1ed25c292229ecc509b65fb35484bf8
2018-01-26 00:25:35 ProcessMessage: hashCheckpoint=00000000016a6e54262b21665e97422db1ed25c292229ecc509b65fb35484bf8
2018-01-26 01:05:08 socket receive timeout: 2295s
2018-01-26 01:05:08 socket receive timeout: 2372s
2018-01-26 01:05:08 socket receive timeout: 2324s
2018-01-26 01:05:08 socket receive timeout: 2372s
2018-01-26 01:05:08 socket receive timeout: 2302s
2018-01-26 01:05:08 socket receive timeout: 2372s
2018-01-26 01:05:08 socket receive timeout: 2344s
2018-01-26 01:05:08 socket receive timeout: 2343s
2018-01-26 01:05:32 keypool return 2
2018-01-26 01:05:32 keypool reserve 2
2018-01-26 01:06:15 receive version message: /HTMLCOIN:2.0.0.3/: version 70001, blocks=95398, us=115.91.88.76:50911, peer=9
2018-01-26 01:06:15 CSyncCheckpoint::ProcessSyncCheckpoint: pending for sync-checkpoint 000000000521e78ef42fefc11a5f513234b7f0a55f0bcbbd540230fc6e6ebd44
2018-01-26 01:06:15 ERROR: AcceptBlock: bad-witness-nonce-size, ContextualCheckBlock : invalid witness nonce size (code 16)
2018-01-26 01:06:15 Misbehaving: 178.62.16.183:4888 peer=9 (0 -> 100) BAN THRESHOLD EXCEEDED
2018-01-26 01:06:15 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-01-26 01:06:15 ERROR: ProcessNetBlock: ProcessNewBlock FAILED
2018-01-26 01:06:32 receive version message: /HTMLCOIN:2.0.0.2/: version 70001, blocks=95399, us=115.91.88.76:50924, peer=10
2018-01-26 01:06:32 ProcessSyncCheckpoint: sync-checkpoint at 000000000005f26ff5ca921de84c66847904e35d1818207d508b1126e83e1c47
2018-01-26 01:06:32 ProcessMessage: hashCheckpoint=000000000005f26ff5ca921de84c66847904e35d1818207d508b1126e83e1c47
2018-01-26 01:06:32 UpdateTip: new best=000000000271bbca8bef1d720699f46835ba0b25f7794193d08825c59b74f4b2 height=95363 version=0x20000000 log2_work=78.415773 tx=179210 date='2018-01-26 00:29:58' progress=0.011217 cache=3.2MiB(26033txo)
2018-01-26 01:06:32 ERROR: ContextualCheckBlock : rejected by synchronized checkpoint
2018-01-26 01:06:32 ERROR: TestBlockValidity: Consensus::ContextualCheckBlock: bad-version (code 17)
2018-01-26 01:06:32 keypool return 2
2018-01-26 01:06:32 ProcessNetBlock: ACCEPTED
2018-01-26 01:06:32 UpdateTip: new best=adb8fcc7d6ab5cc645156521b14c46e647ec8860f92d7e866211c8e99185ed5f height=95364 version=0x20000000 log2_work=78.41585 tx=179212 date='2018-01-26 00:30:24' progress=0.011351 cache=3.2MiB(26038txo)
2018-01-26 01:06:32 ProcessNetBlock: ACCEPTED
2018-01-26 01:06:32 UpdateTip: new best=63a978df9c2968eb94c10401f65a10c9bea690d115f1c2d268b9bc8093a35330 height=95365 version=0x20000000 log2_work=78.415926 tx=179214 date='2018-01-26 00:31:12' progress=0.011605 cache=3.2MiB(26043txo)
2018-01-26 01:06:32 ProcessNetBlock: ACCEPTED
2018-01-26 01:06:32 UpdateTip: new best=8a642b9db0af4c690232fe9a046c20256e55e3d7170b894ed6515d3b4fb3fe76 height=95366 version=0x20000000 log2_work=78.416002 tx=179216 date='2018-01-26 00:31:28' progress=0.011692 cache=3.2MiB(26046txo)
2018-01-26 01:06:32 ProcessNetBlock: ACCEPTED
2018-01-26 01:06:32 UpdateTip: new best=ea4427f7152a90a8eca717989f85e9af6d470791d3c636fed6aacb5d10b6a3f3 height=95367 version=0x20000000 log2_work=78.416077 tx=179221 date='2018-01-26 00:33:36' progress=0.012440 cache=3.2MiB(26052txo)
2018-01-26 01:06:32 ProcessNetBlock: ACCEPTED
2018-01-26 01:06:32 UpdateTip: new best=131e8559988d2f38bd95f840dfb3d4104f3cb07e5cd200792034bd028a0ce28c height=95368 version=0x20000000 log2_work=78.416152 tx=179224 date='2018-01-26 00:34:40' progress=0.012852 cache=3.2MiB(26058txo)
2018-01-26 01:06:32 ProcessNetBlock: ACCEPTED









위의 분석을 모두 마친 후..
혹시 Github에 이런 이슈가 없었을까 싶어 이슈란에 찾아보니 역시나 있었다..;;
진작 찾아볼껄 그랬네;;
1004lucifer
https://github.com/HTMLCOIN/HTMLCOIN/issues/12


- 위와같이 싱크가 제대로 되지 않아 에러가 보여진거라고 답변을 주고 이슈를 종료시켜 버렸다.



[Blockchain] How to Install NOMP (채굴풀/마이닝풀 설치방법)









채굴풀을 만드려면 어떻게 해야 하는지 알아보다가 오픈소스가 있어서 설치를 해봤다.
(공식홈페이지를 보니 국내 마이닝풀 사이트 https://miningpoolhub.com/ 에서도 해당 오픈소스를 이용하여 구축을 했다고 한다.)




NOMP (Node Open Mining Portal)
 - https://github.com/zone117x/node-open-mining-portal

1004lucifer
Ubuntu: 16.04




lucifer@ubuntu:~$
lucifer@ubuntu:~$ sudo su -
[sudo] password for 1004lucifer:
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
autoconf is already the newest version (2.69-9).
autoconf set to manually installed.
autotools-dev is already the newest version (20150820.1).
build-essential is already the newest version (12.1ubuntu2).
libtool is already the newest version (2.4.6-0.1).
pkg-config is already the newest version (0.29.1-0ubuntu1).
libssl-dev is already the newest version (1.0.2g-1ubuntu4.10).
0 upgraded, 0 newly installed, 0 to remove and 98 not upgraded.
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
Setting up node-sha (1.2.3-1) ...
Setting up node-slide (1.1.4-1) ...
Setting up nodejs-legacy (4.2.6~dfsg-1ubuntu4.1) ...
Setting up npm (3.5.2-0ubuntu4) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# add-apt-repository ppa:bitcoin/bitcoin
 Stable Channel of bitcoin-qt and bitcoind for Ubuntu, and their dependencies

Note that you should prefer to use the official binaries, where possible, to limit trust in Launchpad/the PPA owner.

No longer supports precise, due to its ancient gcc and Boost versions.
 More info: https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpln5r6c2i/secring.gpg' created
gpg: keyring `/tmp/tmpln5r6c2i/pubring.gpg' created
gpg: requesting key 8842CE5E from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpln5r6c2i/trustdb.gpg: trustdb created
gpg: key 8842CE5E: public key "Launchpad PPA for Bitcoin" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# apt-get update
Hit:1 http://kr.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://kr.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Hit:4 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu xenial InRelease
Get:5 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [710 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [660 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [580 kB]
Get:8 http://kr.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [538 kB]
Get:9 http://kr.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6,628 B]
Get:10 http://kr.archive.ubuntu.com/ubuntu xenial-backports/universe i386 Packages [6,612 B]
Get:11 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Fetched 2,807 kB in 6s (433 kB/s)
Reading package lists... Done
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# apt-get install libdb4.8-dev libdb4.8++-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libdb4.8-dev is already the newest version (4.8.30-xenial4).
libdb4.8++-dev is already the newest version (4.8.30-xenial4).
0 upgraded, 0 newly installed, 0 to remove and 98 not upgraded.
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3535  100  3535    0     0   4136      0 --:--:-- --:--:-- --:--:--  4134
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
remote: Counting objects: 6699, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 6699 (delta 3), reused 10 (delta 3), pack-reused 6684
Receiving objects: 100% (6699/6699), 2.07 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (4155/4155), done.
Checking connectivity... done.
Note: checking out 'v0.16.1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 64de890... v0.16.1
Deleted branch master (was 6dd9ecb).

=> Appending source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# source ~/.profile
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# nvm install 0.10.25
######################################################################## 100.0%
Now using node v0.10.25
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# nvm use 0.10.25
Now using node v0.10.25
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# git clone https://github.com/zone117x/node-open-mining-portal.git nomp
Cloning into 'nomp'...
remote: Counting objects: 2556, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 2556 (delta 3), reused 4 (delta 2), pack-reused 2548
Receiving objects: 100% (2556/2556), 712.15 KiB | 439.00 KiB/s, done.
Resolving deltas: 100% (1540/1540), done.
Checking connectivity... done.
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# cd nomp
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# npm update
npm http GET https://registry.npmjs.org/dateformat/latest
npm http GET https://registry.npmjs.org/node-json-minify/latest
npm http GET https://registry.npmjs.org/redis/latest
npm http GET https://registry.npmjs.org/mysql/latest
npm http GET https://registry.npmjs.org/async/latest
npm http GET https://registry.npmjs.org/express/latest
...
bignum@0.12.5 node_modules/bignum
├── nan@2.8.0
└── node-pre-gyp@0.6.39 (detect-libc@1.0.3, semver@5.5.0, rc@1.2.5, mkdirp@0.5.1, nopt@4.0.1, hawk@3.1.3, tar@2.2.1, rimraf@2.6.2, tar-pack@3.4.1, npmlog@4.1.2, request@2.81.0)
node-pre-gyp http GET https://rvagg-node.s3-us-west-2.amazonaws.com/bignum/v0.12.5/bignum-v0.12.5-node-v11-linux-x64.tar.gz
node-pre-gyp http 200 https://rvagg-node.s3-us-west-2.amazonaws.com/bignum/v0.12.5/bignum-v0.12.5-node-v11-linux-x64.tar.gz
[bignum] Success: "/root/nomp/node_modules/stratum-pool/node_modules/bignum/binding/bignum.node" is installed via remote
stratum-pool@0.1.9 node_modules/stratum-pool
├── base58-native@0.1.4
├── async@2.6.0 (lodash@4.17.4)
├── multi-hashing@0.0.9 (bindings@1.3.0)
└── bignum@0.12.5 (nan@2.8.0, node-pre-gyp@0.6.39)
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# node init.js
config.json file does not exist. Read the installation/setup instructions.
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# cp config_example.json config.json
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp#
root@ubuntu:~/nomp# node init.js
2018-02-03 00:58:30 [POSIX]     [Connection Limit] (Safe to ignore) POSIX module not installed and resource (connection) limit was not raised
2018-02-03 00:58:30 [Master]    [PoolSpawner] No pool configs exists or are enabled in pool_configs folder. No pools spawned.
2018-02-03 00:58:30 [Master]    [CLI] CLI listening on port 17117
2018-02-03 00:58:30 [Website]   [Server] Website started on 0.0.0.0:80
(node-watch) First param in callback function  is replaced with event name since 0.5.0, use  `(evt, filename) => {}` if you want to get the filename







설치 및 기동 시 아래와 같은 에러가 발생 시 링크 확인 후 조치하면 된다.

1. SyntaxError: Use of const in strict mode
 - http://1004lucifer.blogspot.kr/2018/02/nomp-error-syntaxerror-use-of-const-in.html

2. Error: Module did not self-register
 - http://1004lucifer.blogspot.kr/2018/02/nomp-error-module-did-not-self-register_3.html






정상적으로 설치 / 기동하게되면 접속 시 아래와 같이 보여진다.




how to install nomp server and nodejs
Quickstart Guide to NOMP
setup mining pool

참고
 - https://blockgen.net/setup-your-own-mining-pool/