Uncaught node.js Error
Вложений: 1
Ребзя,спасайте,в общем установил я Kite & Lightning для скачивания демки на окулус рифт , при нажатии кнопочки "download" вылезает вот это "
Uncaught node.js Error TypeError: Cannot read property 'senzaPeso' of null at getDownloadUrl (C:\Users\sba\AppData\Local\Temp\nw1268_20379\app\ Downloader.js:32:79) at Downloader.downloadFile [as download] (C:\Users\sba\AppData\Local\Temp\nw1268_20379\app\ Downloader.js:122:17) at ItemView.<anonymous> (C:\Users\sba\AppData\Local\Temp\nw1268_20379\app\ Item.js:199:16) at l (file:///C:/Users/sba/AppData/Local/Temp/nw1268_20379/vendor.js:11879:2300) at ItemView.b.trigger (file:///C:/Users/sba/AppData/Local/Temp/nw1268_20379/vendor.js:11879:1703) at HTMLButtonElement.<anonymous> (file:///C:/Users/sba/AppData/Local/Temp/nw1268_20379/ui.js:31:12) at HTMLButtonElement.n.event.dispatch (file:///C:/Users/sba/AppData/Local/Temp/nw1268_20379/vendor.js:3:6404) at HTMLButtonElement.r.handle (file:///C:/Users/sba/AppData/Local/Temp/nw1268_20379/vendor.js:3:3179) " |
Blackmilk,
из ошибки видно, что ты пытаешься использовать свойство "senzaPeso" у null. |
И как мне это исправить ?
|
Blackmilk,
откуда мне знать? Ты ничего не дал кроме кода ошибки. |
var Promise = require('bluebird')
, fs = require('fs-extra') , os = require('os') , path = require('path') , request = require('request') , progress = require('request-progress') , DecompressZip = require('decompress-zip') , exec = Promise.promisify(require('child_process').exec) , BackboneEvents = require("backbone-events-standalone") , injector = require('../injector').getInstance() var rm = Promise.promisify(fs.remove) , cp = Promise.promisify(fs.copy) // events var CLEANING = 'cleaning' , EXTRACTING = 'extracting' , PROGRESS = 'progress' , COMPLETE = 'complete' , COPYING = 'copying' function Downloader(versions) { var tmpDir = os.tmpDir() , self = this function mac() { return process.platform === 'darwin' } function getDownloadUrl(download) { var path = mac() ? versions[download.stringsKey]['mac']['path'] : versions[download.stringsKey]['win']['path'] return injector.inject('serverBaseUrl') + path } function getDownloadPath(download, pickNew) { if (pickNew === true) { tmpDir = os.tmpDir() } return path.join(tmpDir, path.basename(getDownloadUrl(download))) } function getApplicationsFolder(download) { if (mac()) { return path.join('/Applications', 'Kite & Lightning') } else { console.log('download.win64:', download.win.win64) if (download.win.win64 === true) { return path.join('C:/', 'Program Files', 'Kite & Lightning') } else { return path.join('C:/', 'Program Files (x86)', 'Kite & Lightning') } } } // this is where the unzipped file gets stored function getSaveAsPath(download) { if (mac()) { return path.join(getApplicationsFolder(download), download.mac.saveAs) } else { return path.join(getApplicationsFolder(download), download.win.saveAs) } } function copyFromDmg(download) { console.log('opening dmg...') // attach the .dmg, nobrowse prevents the dmg from popping up in the Finder return exec('hdiutil attach ' + getDownloadPath(download) + ' -nobrowse') .then(function () { console.log(COPYING) var copyFrom = path.join('/Volumes', download.mac.dmgName, download.mac.saveAs) , copyTo = getSaveAsPath(download) return cp(copyFrom, copyTo) }) .then(function () { // detach the .dmg self.trigger(CLEANING) return exec('hdiutil detach /Volumes/' + download.mac.dmgName) }) .then(function () { // clean up // return Promise.all([ return rm(getDownloadPath(download)).then(function () { self.trigger(COMPLETE) }) // ]) }).catch(function (e) { console.error(e) }) } function extractFile(download) { var unzip = new DecompressZip(getDownloadPath(download)) , extractTo = getSaveAsPath(download) console.log(getDownloadPath(download)) console.log(extractTo) unzip.on('error', function (err) { console.error('unzip error:', err) }) unzip.on('extract', function (log) { // extracting directly to saveAsPath self.trigger(CLEANING) rm(getDownloadPath(download)) .then(function () { self.trigger(COMPLETE) alert('Your demo was installed at the following path: ' + extractTo + ' If you wish to uninstall, simply delete that folder.') }) }) fs.remove(extractTo, function (err) { if (err) return console.error(err) unzip.extract({ path: extractTo }) console.log("removed old version.") }) } function downloadFile(download, selfUpdate) { console.log(getDownloadUrl(download)) progress(request(getDownloadUrl(download)), { throttle: 100 // #ms between updates }) .on('progress', function (state) { console.log('received size in bytes', state.received) console.log('total size in bytes', state.total) console.log('percent', state.percent) self.trigger(PROGRESS, state.percent, state.received, state.total) }) .on('error', function (err) { console.error('download failed ', err) }) .pipe(fs.createWriteStream(getDownloadPath(downloa d, true))) .on('error', function (err) { console.error('saving to disk failed ', err) }) .on('close', function (err) { if (err) { console.error(err) } else if (mac()) { copyFromDmg(download) self.trigger(EXTRACTING) } else { // Windows will launch InnoSetup for extraction/installation path selection // shell.openItem(getDownloadPath(download, false)) self.trigger(COMPLETE, getDownloadPath(download, false)) } }) } this.download = downloadFile this.getSaveAsPath = getSaveAsPath } BackboneEvents.mixin(Downloader.prototype) Downloader.COPYING = COPYING Downloader.COMPLETE = COMPLETE Downloader.EXTRACTING = EXTRACTING Downloader.CLEANING = CLEANING Downloader.PROGRESS = PROGRESS module.exports = Downloade |
Blackmilk,
давай по порядку. 1. На форуме принято оформлять код скриптов в специальные теги для подсветки синтаксиса. Иначе мало кто захочет читать эту однородную простыню кода. 2. В приведённом тобой коде нет использования свойства "senzaPeso", так что ты, видимо, ошибся и скопировал не то, что нужно. |
видишь ли , я сам то не особо в этом разбираюсь, но как я понял "senzaPeso" как название игры посылается в этот файл,при запуске же этого файла у меня вылазит ошибка с кодом 800А03F2 " предполагается наличие индентификатора в 87 строке
}).catch(function (e) { |
весь код
var Promise = require('bluebird') , fs = require('fs-extra') , os = require('os') , path = require('path') , request = require('request') , progress = require('request-progress') , DecompressZip = require('decompress-zip') , exec = Promise.promisify(require('child_process').exec) , BackboneEvents = require("backbone-events-standalone") , injector = require('../injector').getInstance() var rm = Promise.promisify(fs.remove) , cp = Promise.promisify(fs.copy) // events var CLEANING = 'cleaning' , EXTRACTING = 'extracting' , PROGRESS = 'progress' , COMPLETE = 'complete' , COPYING = 'copying' function Downloader(versions) { var tmpDir = os.tmpDir() , self = this function mac() { return process.platform === 'darwin' } function getDownloadUrl(download) { var path = mac() ? versions[download.stringsKey]['mac']['path'] : versions[download.stringsKey]['win']['path'] return injector.inject('serverBaseUrl') + path } function getDownloadPath(download, pickNew) { if (pickNew === true) { tmpDir = os.tmpDir() } return path.join(tmpDir, path.basename(getDownloadUrl(download))) } function getApplicationsFolder(download) { if (mac()) { return path.join('/Applications', 'Kite & Lightning') } else { console.log('download.win64:', download.win.win64) if (download.win.win64 === true) { return path.join('C:/', 'Program Files', 'Kite & Lightning') } else { return path.join('C:/', 'Program Files (x86)', 'Kite & Lightning') } } } // this is where the unzipped file gets stored function getSaveAsPath(download) { if (mac()) { return path.join(getApplicationsFolder(download), download.mac.saveAs) } else { return path.join(getApplicationsFolder(download), download.win.saveAs) } } function copyFromDmg(download) { console.log('opening dmg...') // attach the .dmg, nobrowse prevents the dmg from popping up in the Finder return exec('hdiutil attach ' + getDownloadPath(download) + ' -nobrowse') .then(function () { console.log(COPYING) var copyFrom = path.join('/Volumes', download.mac.dmgName, download.mac.saveAs) , copyTo = getSaveAsPath(download) return cp(copyFrom, copyTo) }) .then(function () { // detach the .dmg self.trigger(CLEANING) return exec('hdiutil detach /Volumes/' + download.mac.dmgName) }) .then(function () { // clean up // return Promise.all([ return rm(getDownloadPath(download)).then(function () { self.trigger(COMPLETE) }) // ]) }).catch(function (e) { console.error(e) }) } function extractFile(download) { var unzip = new DecompressZip(getDownloadPath(download)) , extractTo = getSaveAsPath(download) console.log(getDownloadPath(download)) console.log(extractTo) unzip.on('error', function (err) { console.error('unzip error:', err) }) unzip.on('extract', function (log) { // extracting directly to saveAsPath self.trigger(CLEANING) rm(getDownloadPath(download)) .then(function () { self.trigger(COMPLETE) alert('Your demo was installed at the following path: ' + extractTo + ' If you wish to uninstall, simply delete that folder.') }) }) fs.remove(extractTo, function (err) { if (err) return console.error(err) unzip.extract({ path: extractTo }) console.log("removed old version.") }) } function downloadFile(download, selfUpdate) { console.log(getDownloadUrl(download)) progress(request(getDownloadUrl(download)), { throttle: 100 // #ms between updates }) .on('progress', function (state) { console.log('received size in bytes', state.received) console.log('total size in bytes', state.total) console.log('percent', state.percent) self.trigger(PROGRESS, state.percent, state.received, state.total) }) .on('error', function (err) { console.error('download failed ', err) }) .pipe(fs.createWriteStream(getDownloadPath(downloa d, true))) .on('error', function (err) { console.error('saving to disk failed ', err) }) .on('close', function (err) { if (err) { console.error(err) } else if (mac()) { copyFromDmg(download) self.trigger(EXTRACTING) } else { // Windows will launch InnoSetup for extraction/installation path selection // shell.openItem(getDownloadPath(download, false)) self.trigger(COMPLETE, getDownloadPath(download, false)) } }) } this.download = downloadFile this.getSaveAsPath = getSaveAsPath } BackboneEvents.mixin(Downloader.prototype) Downloader.COPYING = COPYING Downloader.COMPLETE = COMPLETE Downloader.EXTRACTING = EXTRACTING Downloader.CLEANING = CLEANING Downloader.PROGRESS = PROGRESS module.exports = Downloade |
Часовой пояс GMT +3, время: 11:34. |