我最近通过npm安装了一个名为'trilat‘的包。
在安装此软件包后,我看到了一条警告。(它说我跳过了可选依赖: fsevents@1.1.3 (node_modules/fsevents)和不支持的fsevents平台@1.1.3: wanted {"os":"darwin","arch":"any"} (current:{"os":"win32","arch":"x64"})
我并不关心这个错误,因为npm安装了整个包。
但是在我使用这个包编写代码后,我看到了一条错误消息,看起来像问题标题。
它说明该对象不是函数(计算' abstractMatrix ()'),而abstractMatrix是在包中声明的函数。
我没有看到这个错误是由于fsevent( npm说它在darwin中被支持)引起的。
以下是与abstractMatrix()相关的部分代码
function abstractMatrix(superCtor) {
if (superCtor === undefined) superCtor = Object;
/**
* Real matrix
* @class Matrix
* @param {number|Array|Matrix} nRows - Number of rows of the new matrix,
* 2D array containing the data or Matrix instance to clone
* @param {number} [nColumns] - Number of columns of the new matrix
*/
class Matrix extends superCtor {
static get [Symbol.species]() {
return this;
}。。。诸若此类
我做错了什么?
发布于 2018-01-17 16:45:40
如果要在浏览器中使用此功能而不使用browserify/webpack/etc,请包括dist.js文件,该文件会将符号trilat公开为全局函数。
来自项目作者的最后一句话,这里是来自this代码库的。
因此,将该项目中的dist.js文件包含到您的项目src文件中,甚至可以将其放在您的utils目录中,并将其导入到您想要使用的文件中。
该项目使用了webpack/browserify和其他我怀疑是否包含在您的构建中的东西。
https://stackoverflow.com/questions/48276960
复制相似问题