Immutable-ext 找不到模块

Immutable-ext Cannot find module

安装了 Immutable-ext:

const { List } = require("immutable-ext");

const one = ["one", "two", "three"];
const two = ["one", "four", "five"];

它returns这个错误:

Error: Cannot find module 'immutable'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\user\Desktop\functional\node_modules\immutable-ext\index.js:1:81)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

有什么想法吗?

immutable-ext 有 immutable as a peer dependency。这意味着你必须自己安装不可变的。

https://npm.github.io/using-pkgs-docs/package-json/types/peerdependencies.html:

NOTE: npm versions 1 and 2 will automatically install peerDependencies if they are not explicitly depended upon higher in the dependency tree. In the next major version of npm (npm@3), this will no longer be the case. You will receive a warning that the peerDependency is not installed instead.