TypeError:pna.nextTick不是函数

时间:2018-06-28 13:50:54

标签: angular

我试图将现有的角度网站从角度版本5更新到版本6。在更新package.json中的值并将.angular-cli.json迁移为新的angular.json格式后,我尝试运行我的应用程序,它崩溃并显示此错误:

TypeError: pna.nextTick is not a function
at maybeReadMore (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:517:9)
at addChunk (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:300:3)
 at readableAddChunk (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:278:11)
 at DestroyableTransform.Readable.push (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:245:10)
 at DestroyableTransform.Transform.push (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_transform.js:148:32)
 at DestroyableTransform.afterTransform (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_transform.js:91:10)
 at DestroyableTransform.noop [as _transform] (/my_hd/node_modules/npm/node_modules/mississippi/node_modules/through2/through2.js:26:3)
 at DestroyableTransform.Transform._read (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_transform.js:184:10)
 at DestroyableTransform.Transform._write (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_transform.js:172:83)
 at doWrite (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
 at writeOrBuffer (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5)
 at DestroyableTransform.Writable.write (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11)
 at cacheStream.write (/my_hd/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:183:17)
 at afterWrite (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:491:3)
 at onwrite (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:483:7)
 at WritableState.onwrite (/my_hd/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:180:5)

当我去查看_stream_可读的javascript文件时,以下是mayReadRead方法和addChunk方法的源代码:

// at this point, the user has presumably seen the 'readable' event,
// and called read() to consume some data.  that may have triggered
// in turn another _read(n) call, in which case reading = true if
// it's in progress.
// However, if we're not ended, or reading, and the length < hwm,
// then go ahead and try to read some more preemptively.
function maybeReadMore(stream, state) {
  if (!state.readingMore) {
    state.readingMore = true;
    pna.nextTick(maybeReadMore_, stream, state); // this is line 517 that crashes
  }
}

// this is the addChunk method which calls maybeReadMore
function addChunk(stream, state, chunk, addToFront) {
  if (state.flowing && state.length === 0 && !state.sync) {
    stream.emit('data', chunk);
    stream.read(0);
  } else {
    // update the buffer info.
    state.length += state.objectMode ? 1 : chunk.length;
    if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);

    if (state.needReadable) emitReadable(stream);
  }
  maybeReadMore(stream, state); // this is line 300 which calls maybeReadMore
}

我会注意到我没有写这个read_stream库。它似乎与我的角度依赖关系之一有关。我对这个问题做了谷歌搜索,发现有一个“可读流”依赖项可以添加到package.json中。刚开始遇到此错误时,我尝试将以下行手动添加到package.json:

"readable-stream": "2.3.6",

但是,错误消息保持不变。我原来的package.json文件没有列出可读流。

有人知道哪个依赖性可能导致此问题或如何解决此问题吗?

谢谢。

0 个答案:

没有答案