Closed smussell closed 11 years ago
This seems to be a problem with version 0.8.10 of kriskowal/q, which for some reason seems to break backwards compatibility with .end()
. I've just released version 1.0.2 of nodefront which only uses q at version 0.8.9. Let me know if you continue to experience issues.
Yeh, we should ideally start moving over to the new .done()
method, as .end()
is deprecated, but I'm curious to find out how backwards compatibility has been affected.
There are two things going on here:
The first stack trace is not an error. The deprecation warnings have a stack trace, and that's what you're seeing.
The second error is indeed a minor backward-compat issue, because you are using Q a bit strangely. When env.compile
is falsy, you guys do
promise = q.defer().resolve();
to try to get a resolved promise. But deferred.resolve()
was never meant to return a promise; instead it just performs the operation of resolving the promise associated to the deferred. (See command-query separation.) It was a bug that, sometimes, under certain conditions, deferred.resolve()
would return deferred.promise
. In Q 0.8.10, we fixed that bug, so now deferred.resolve()
always returns nothing (since it's a command, not a query).
The correct fix would be to use
promise = q.resolve();
which is the canonical way of getting an already-fulfilled promise in Q.
Ah, yes, I understand. Thanks @domenic. I'll get this fixed and revert back to 0.8.x shortly.
I've updated all .end()
calls to .done()
and fixed the fulfilled promise issues. Let me know if you run into any further problems.
The following error is occurring when trying to run nodefront on a clean install.
end is deprecated, use done instead. Error at Object.exports.nextTick as end at makePromise.(anonymous function) as end at Command.withSettings (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander-config/index.js:99:12) at Command.action (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander/lib/commander.js:235:8) at Command.EventEmitter.emit (events.js:126:20) at Command.parseArgs (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander/lib/commander.js:406:12) at Command.parse (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander/lib/commander.js:352:15) at Object. (/usr/local/share/npm/lib/node_modules/nodefront/nodefront.js:100:9)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
Serving your files at http://127.0.0.1:3000/.
/usr/local/share/npm/lib/node_modules/nodefront/node_modules/q/q.js:1440 throw error; ^ TypeError: Cannot call method 'end' of undefined at Command. (/usr/local/share/npm/lib/node_modules/nodefront/commands/serve.js:89:14)
at /usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander-config/index.js:98:16
From previous event:
at Command.withSettings (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander-config/index.js:85:38)
at Command. (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander/lib/commander.js:235:8)
at Command.emit (events.js:126:20)
at Command.parseArgs (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander/lib/commander.js:406:12)
at Command.parse (/usr/local/share/npm/lib/node_modules/nodefront/node_modules/commander/lib/commander.js:352:15)
at Object. (/usr/local/share/npm/lib/node_modules/nodefront/nodefront.js:100:9)