我刚刚发现了immutable.js。 我想尝试一下它,习惯它的工作原理。 真的很简单。甚至不需要编写代码,只需要关注 交互地在节点外壳中。
我已经安装了它:
$ npm install immutable
npm WARN saveError ENOENT: no such file or directory, open '/home/xxxxxxx/node/immutable/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/xxxxxxx/node/immutable/package.json'
npm WARN immutable No description
npm WARN immutable No repository field.
npm WARN immutable No README data
npm WARN immutable No license field.
+ immutable@3.8.2
added 1 package from 1 contributor and audited 1 package in 2.934s
found 0 vulnerabilities
...然后我尝试使用它。
$ node
> const { Map } = require('immutable');
ReferenceError: Map is not defined
at Module._compile (internal/modules/cjs/loader.js:683:37)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
$ node -v
v10.10.0
$ npm -v
6.4.1
在理解我可能错过的内容方面提供一点帮助真的很酷。
TIA
更新: 只是为了它,我尝试了这个:
$ sudo npm install immutable
现在它可以工作了 ???