2016-12-09 1 views
0

開発環境でノード6.9に更新しようとしているノード0.10を使用して、私たちの会社のプログラマーが作成したコードがあります。私はNodeの専門家ではありません。Nodeとコードが私たちのために残っていることを学ぶプロジェクトです。ノードカスタムスクリプトのインストール時のエラー

私はスクリプトをインストールreccomendedを実行すると、私はこのエラーを取得:

# node install.js --production 
path.js:7 
    throw new TypeError('Path must be a string. Received ' + inspect(path)); 
    ^

TypeError: Path must be a string. Received undefined 
    at assertPath (path.js:7:11) 
    at Object.dirname (path.js:1324:5) 
    at new daemon (/var/www/ClientResponder/node_modules/node-linux/lib/daemon.js:208:30) 
    at Object.<anonymous> (/var/www/ClientResponder/install/install.js:13:11) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 
    at Module.load (module.js:487:32) 
    at tryModuleLoad (module.js:446:12) 
    at Function.Module._load (module.js:438:3) 
    at Module.runMain (module.js:604:10) 

私は、ファイルたinstall.jsを見て、このようなライン11が起動オフ:

/** 
* Created by Tim. 
*/ 

var Service = require('node-linux').Service; 

var env = null; 
if(process.argv.length === 3){ 
    env = process.argv[2] === "--production" ? "production" : "staging"; 
} 

// Create a new service object 
var svc = new Service({ 
    name:'Client Responder', 
    description: "Optional web server which can be deployed to a Media Server providing user clients the ability to ping the server for speed tests.", 
    script: '/var/www/ClientResponder/server.js', 
    env: [{ 
     name: "NODE_ENV", 
     value: env ? env : "staging" 
    },{ 
     name: "PORT", 
     value: 8888 
    }] 
}); 

// Listen for the "install" event, which indicates the 
// process is available as a service. 
svc.on('install',function(){ 
    svc.start(); 
}); 

svc.install(); 

私は」didnのトンパスについてそこに何を参照してくださいので、私はライン208でdaemon.jsファイルを見て、この取得:

cwd: {  
    enumerable: false,   
    writable: true,   
    configurable: false,   
    value: config.cwd || p.dirname(this.script) 
},  

何を私はここで行方不明ですか?すべてのソースコードに完全にアクセスできない場合、完全なアクセスが不十分な場合は何を提供すればいいのか分かりません。

+0

は、それは 'util.inspect' [ドキュメント](https://nodejs.org/api/util.html#をすべきではありませんutil_util_inspect_object_options)を 'inspect'の代わりに使用していますか? – joaumg

+0

わかりませんが、それはエラーmsgの一部です。 – Alan

+0

'util.inspect'の' inspect'を変更し、さらにファイルの先頭にrequireを追加し、このエラーがスローされた場所の 'if'(もしあれば' path.js'の6行目)を提供してください – joaumg

答えて

1

ここで推奨される回避策は、this issueに従うことです。

と変更:

var svc = new Service({ 
    name:'Client Responder', 
    description: "Optional web server which can be deployed to a Media Server providing user clients the ability to ping the server for speed tests.", 
    script: '/var/www/ClientResponder/server.js', 
    env: [{ 
     name: "NODE_ENV", 
     value: env ? env : "staging" 
    },{ 
     name: "PORT", 
     value: 8888 
    }] 
}); 

へ:

var svc = new Service({ 
    name:'Client Responder', 
    description: "Optional web server which can be deployed to a Media Server providing user clients the ability to ping the server for speed tests.", 
    script: 'server.js', // here 
    cwd: '/var/www/ClientResponder/', // and here 
    env: [{ 
     name: "NODE_ENV", 
     value: env ? env : "staging" 
    },{ 
     name: "PORT", 
     value: 8888 
    }] 
}); 
関連する問題