Javascript 在另一个函数中调用promise函数时出错
当我尝试使用命令将其加载到交互式节点控制台时,下面的代码给出了一个错误 这是我的错误:Javascript 在另一个函数中调用promise函数时出错,javascript,node.js,promise,Javascript,Node.js,Promise,当我尝试使用命令将其加载到交互式节点控制台时,下面的代码给出了一个错误 这是我的错误: Failed to load:myFile.js _stream_writable.js:258 process.nextTick(function() { ^ TypeError: Object function (val){ promise1(val); } has no method 'nextTick' at onwrite (_stream_writ
Failed to load:myFile.js
_stream_writable.js:258
process.nextTick(function() {
^
TypeError: Object function (val){
promise1(val);
} has no method 'nextTick'
at onwrite (_stream_writable.js:258:15)
at WritableState.onwrite (_stream_writable.js:97:5)
at WriteStream.Socket._write (net.js:651:5)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at WriteStream.Writable.write (_stream_writable.js:180:11)
at WriteStream.Socket.write (net.js:613:40)
at REPLServer.repl.defineCommand.action (repl.js:858:27)
at REPLServer.parseREPLKeyword (repl.js:670:16)
at Interface.<anonymous> (repl.js:219:16)
知道为什么吗?进程是一个内置的Node.js全局进程
通过在REPL中创建自己的流程变量(该变量没有自己的作用域),您打破了一切。流程是一个内置的Node.js全局变量
通过在REPL中创建自己的流程变量(该变量没有自己的作用域),您可以破坏所有内容。这是一种更有效的方法,可以破坏所有不需要故意恶意的内容,例如delete Array.prototype.forEach或Object.prototype.hasOwnProperty=函数{return 0;};这是一种更有效的方法,可以破坏所有不需要故意恶意的东西,例如delete Array.prototype.forEach或Object.prototype.hasOwnProperty=function{return 0;};
Failed to load:myFile.js
_stream_writable.js:258
process.nextTick(function() {
^
TypeError: Object function (val){
promise1(val);
} has no method 'nextTick'
at onwrite (_stream_writable.js:258:15)
at WritableState.onwrite (_stream_writable.js:97:5)
at WriteStream.Socket._write (net.js:651:5)
at doWrite (_stream_writable.js:219:10)
at writeOrBuffer (_stream_writable.js:209:5)
at WriteStream.Writable.write (_stream_writable.js:180:11)
at WriteStream.Socket.write (net.js:613:40)
at REPLServer.repl.defineCommand.action (repl.js:858:27)
at REPLServer.parseREPLKeyword (repl.js:670:16)
at Interface.<anonymous> (repl.js:219:16)