所以我有一個node.js腳本附帶一些模塊,我努力運行它(Debian 7)。我已經搜遍並嘗試了不同的「解決方案」,但他們都沒有工作,幫助會很好。Node.js無法找到模塊等
這是我的控制檯輸出:
`[email protected]:/home/bot# node sell.js
module.js:457
throw err;
^
Error: Cannot find module './parser/token_analyzer'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. <anonymous> (/home/bot/node_modules/steam/resources/steam_language_parser/index.js:2:22)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
我想這在我的Windows和它的工作,但它在我的debian只是不工作斷絕出於某種原因
分析器/ token_analyzer目錄:
bot\node_modules\steam\resources\steam_language_parser\parser\token_analyzer.js
請求解析器/ token_analyzer的文件:
bot\node_modules\steam\resources\steam_language_parser\index.js
CODE:
var fs = require('fs');
var token_analyzer = require('./parser/token_analyzer');
var codeGen = require('./generator/node_gen');
var languagePath = require('path').join(__dirname, '../steam_language');
var cwd = process.cwd();
process.chdir(languagePath);
var tokenList = require('./parser/language_parser').tokenizeString(fs.readFileSync('steammsg.steamd', { encoding: 'ascii' }));
var root = token_analyzer.analyze(tokenList);
process.chdir(cwd);
var rootEnumNode = new token_analyzer.Node();
var rootMessageNode = new token_analyzer.Node();
rootEnumNode.childNodes = root.childNodes.filter(function(n) { return n instanceof token_analyzer.EnumNode; });
rootMessageNode.childNodes = root.childNodes.filter(function(n) { return n instanceof token_analyzer.ClassNode; });
require('./code_generator').emitCode(rootEnumNode, codeGen);
require('./code_generator').emitCode(rootMessageNode, codeGen);
你可以顯示你的文件,你需要''./ parser/token_analyzer''嗎?和這個文件存在的地方? – abdulbarik
當然,您是否在'sell.js'的'parser'目錄中有一個名爲'token_analyzer.js'的文件? –
解析器目錄是: – Strykes