totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 450 forks source link

In legacy total.js 1.7.2, "total -translate" always fails on windows: TypeError: Cannot read property 'hash' of undefined #649

Closed truedat101 closed 6 years ago

truedat101 commented 6 years ago

With total.js 1.7.2, running translate, regardless of web app I use, it will always fail with TypeError.

$ total -translate
total.js: creating translation
C:\Users\dx\AppData\Roaming\npm\node_modules\total.js\bin\total:25
if($type===3)return;if(!fs.existsSync(js))fs.mkdirSync(js);if(!fs.existsSync(css))fs.mkdirSync(css);if(!fs.existsSync(img))fs.mkdirSync(img);var buffer=[];buffer.push("User-agent: *");buffer.push("Allow: /");buffer.push("");fs.writeFileSync(path.join(dir,"robots.txt"),buffer.join(EOF));fs.writeFileSync(path.join(css,"default.css"),"LyphdXRvKi8NCg0KYm9keSB7IHBhZGRpbmc6MjBweDsgbWFyZ2luOjA7IGZvbnQ6bm9ybWFsIDEycHggQXJpYWw7IGNvbG9yOiM1MDUwNTA7IH0NCg0KLmNvbnRlbnQgeyBtYXJnaW46MCBhdXRvOyB3aWR0aDogOTYwcHg7IHBhZGRpbmc6IDEwcHg7IGJvcmRlci1yYWRpdXM6IDVweDsgYm94LXNoYWRvdzogMCAwIDIwcHggcmdiYSgwLDAsMCwwLjUpOyBhbmltYXRpb246IG15QW5pbWF0aW9uIDVzIGFsdGVybmF0ZTsgfQ0KDQoubGlzdCB7IGJvcmRlci1ib3R0b206MXB4IHNvbGlkICNFMEUwRTA7IHBhZGRpbmctYm90dG9tOjVweDsgbWFyZ2luLWJvdHRvbTo1cHg7IH0NCi5saXN0ID4gZGl2OmZpcnN0LWNoaWxkIHsgZm9udC1zaXplOiAxNXB4OyB9DQoNCkBrZXlmcmFtZXMgbXlBbmltYXRpb24NCnsNCgkwJSAgIHsgYmFja2dyb3VuZDogd2hpdGU7IH0NCgkyNSUgIHsgYmFja2dyb3VuZDogI0YwRjBGMDsgfQ0KC

TypeError: Cannot read property 'hash' of undefined
    at FileList.onComplete (C:\Users\dx\AppData\Roaming\npm\node_modules\total.js\bin\total:25:7992)
    at FileList.next (C:\Users\dx\AppData\Roaming\npm\node_modules\total.js\utils.js:2:18554)
    at C:\Users\dx\AppData\Roaming\npm\node_modules\total.js\utils.js:2:18304
    at FSReqWrap.oncomplete (fs.js:82:15)
petersirka commented 6 years ago

Hi @truedat101, try to install latest version of Total.js $ npm install -g total.js and let me know.

truedat101 commented 6 years ago

Unfortunately I'm stuck on a legacy version 1.7.2. I would need to port my app.

On Wed, Jul 11, 2018 at 1:43 PM Peter Širka notifications@github.com wrote:

Hi @truedat101 https://github.com/truedat101, try to install latest version of Total.js $ npm install -g total.js and let me know.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/totaljs/framework/issues/649#issuecomment-404303017, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD6ylE1FUUhmlYmOvc-gQXMtiVBqR7nks5uFmNcgaJpZM4VLz6I .

petersirka commented 6 years ago

Maybe I know where the problem is. Try to remove node_modules from app diretory and perform translate again and then recover node_modules. Let me know.

truedat101 commented 6 years ago

So if I remove local node_modules in my app, in this case, just testing in totaljs-examples.git/views (pretty simple project), I get the same error.

truedat101 commented 6 years ago

Also, confirmed same error on Mac OS X with same versions.

truedat101 commented 6 years ago

I suspect if this was not working in the release I am testing, you have fixed this in a later release. If I know what was the problem I can patch locally as I have done in the past.

petersirka commented 6 years ago

Try to install as a global module the latest version of Total: $ npm install total.js and perform translate again. Your project will still use 1.7.2.

truedat101 commented 6 years ago

Hmm, that would work. I am curious what was wrong with 1.7.2. Anyway, I've gone ahead and migrated to total.js@1.9.8 with minimal code changes so I will sit fine with this slightly newer version for now.

truedat101 commented 6 years ago

Feel free to close if this is a "not going to fix" thing.