安装了Immutable-ext:
const { List } = require("immutable-ext");
const one = ["one", "two", "three"];
const two = ["one", "four", "five"];
它返回此错误:
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)
有什么想法吗?
答案 0 :(得分:0)
immutable-ext具有immutable as a peer dependency。这意味着您必须自己安装不可变。
https://npm.github.io/using-pkgs-docs/package-json/types/peerdependencies.html:
注意:如果npm版本1和2没有显式依赖于依赖树中的更高版本,它将自动安装peerDependencies。在npm的下一个主要版本(npm @ 3)中,将不再是这种情况。您将收到一条警告,提示您未安装peerDependency。