找不到模块 'crypto-js' Ubuntu 14.04

Cannot find module 'crypto-js' Ubuntu 14.04

我正在使用 node-red,我从这个 github 下载的一些包遇到了一些问题。我已按照说明获取 npm 并安装它,但我遇到错误,缺少系统中存在的库,有没有人遇到过同样的情况?

提前致谢!

lo@lo-desktop:~$ sudo npm install crypto-js
npm http GET https://registry.npmjs.org/crypto-js
npm http 200 https://registry.npmjs.org/crypto-js
npm http GET https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.6.tgz
npm http 200 https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.6.tgz
crypto-js@3.1.6 node_modules/crypto-js

locate crypto-js
/home/lo/node_modules/crypto-js
/home/lo/node_modules/crypto-js/CONTRIBUTING.md
/home/lo/node_modules/crypto-js/LICENSE
/home/lo/node_modules/crypto-js/README.md
/home/lo/node_modules/crypto-js/aes.js
/home/lo/node_modules/crypto-js/bower.json
/home/lo/node_modules/crypto-js/cipher-core.js
/home/lo/node_modules/crypto-js/core.js
/home/lo/node_modules/crypto-js/crypto-js.js
/home/lo/node_modules/crypto-js/docs
/home/lo/node_modules/crypto-js/enc-base64.js
/home/lo/node_modules/crypto-js/enc-hex.js
/home/lo/node_modules/crypto-js/enc-latin1.js
/home/lo/node_modules/crypto-js/enc-utf16.js
/home/lo/node_modules/crypto-js/enc-utf8.js
/home/lo/node_modules/crypto-js/evpkdf.js
/home/lo/node_modules/crypto-js/format-hex.js
/home/lo/node_modules/crypto-js/format-openssl.js
/home/lo/node_modules/crypto-js/hmac-md5.js
/home/lo/node_modules/crypto-js/hmac-ripemd160.js
/home/lo/node_modules/crypto-js/hmac-sha1.js
/home/lo/node_modules/crypto-js/hmac-sha224.js
/home/lo/node_modules/crypto-js/hmac-sha256.js
/home/lo/node_modules/crypto-js/hmac-sha3.js
/home/lo/node_modules/crypto-js/hmac-sha384.js
/home/lo/node_modules/crypto-js/hmac-sha512.js
/home/lo/node_modules/crypto-js/hmac.js
/home/lo/node_modules/crypto-js/index.js
/home/lo/node_modules/crypto-js/lib-typedarrays.js
/home/lo/node_modules/crypto-js/md5.js
/home/lo/node_modules/crypto-js/mode-cfb.js
/home/lo/node_modules/crypto-js/mode-ctr-gladman.js
/home/lo/node_modules/crypto-js/mode-ctr.js
/home/lo/node_modules/crypto-js/mode-ecb.js
/home/lo/node_modules/crypto-js/mode-ofb.js
/home/lo/node_modules/crypto-js/package.json
/home/lo/node_modules/crypto-js/pad-ansix923.js
/home/lo/node_modules/crypto-js/pad-iso10126.js
/home/lo/node_modules/crypto-js/pad-iso97971.js
/home/lo/node_modules/crypto-js/pad-nopadding.js
/home/lo/node_modules/crypto-js/pad-pkcs7.js
/home/lo/node_modules/crypto-js/pad-zeropadding.js
/home/lo/node_modules/crypto-js/pbkdf2.js
/home/lo/node_modules/crypto-js/rabbit-legacy.js
/home/lo/node_modules/crypto-js/rabbit.js
/home/lo/node_modules/crypto-js/rc4.js
/home/lo/node_modules/crypto-js/ripemd160.js
/home/lo/node_modules/crypto-js/sha1.js
/home/lo/node_modules/crypto-js/sha224.js
/home/lo/node_modules/crypto-js/sha256.js
/home/lo/node_modules/crypto-js/sha3.js
/home/lo/node_modules/crypto-js/sha384.js
/home/lo/node_modules/crypto-js/sha512.js
/home/lo/node_modules/crypto-js/tripledes.js
/home/lo/node_modules/crypto-js/x64-core.js
/home/lo/node_modules/crypto-js/docs/QuickStartGuide.wiki



lo@lo-desktop:~$ node-red -v
Welcome to Node-RED
===================

12 Apr 09:11:41 - [info] Node-RED version: v0.13.4
12 Apr 09:11:41 - [info] Node.js  version: v0.10.25
12 Apr 09:11:41 - [info] Linux 4.2.0-27-generic ia32 LE
12 Apr 09:11:41 - [info] Loading palette nodes
12 Apr 09:11:43 - [warn] ------------------------------------------
12 Apr 09:11:43 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
12 Apr 09:11:43 - [warn] [TTN] Error: Cannot find module 'crypto-js'
12 Apr 09:11:43 - [warn] ------------------------------------------
12 Apr 09:11:43 - [info] Settings file  : /home/lo/.node-red/settings.js
12 Apr 09:11:43 - [info] User directory : /home/lo/.node-red
12 Apr 09:11:43 - [info] Flows file : /home/lo/.node-red/flows_loshora-desktop.json
12 Apr 09:11:43 - [info] Server now running at http://127.0.0.1:1880/
12 Apr 09:11:43 - [info] Starting flows
12 Apr 09:11:43 - [info] Started flows

这看起来像你 运行 npm install crypto-js 在错误的目录中。您的项目位于 /home/lo/ ?

你有 3 种可能性:

  1. 运行 "sudo npm install -g crypto-js" 使其在全球可用 您的机器用于所有项目
  2. 运行 "sudo npm install crypto-js" 在项目的根目录中
  3. (最佳选择)将您的依赖项放入 package.json(配置 NPM 的文件)和项目根目录中的 运行 "sudo npm install"
    • 这将安装 package.json
    • 中的所有依赖项

您应该 npm install crypto-jsnode-red-ttn 文件夹中;或全球。

一直在使用打字稿,直到我 运行

$ npm i --save-dev @types/crypto-js