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

时间:2016-04-12 07:48:51

标签: node.js node-red

我正在使用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

2 个答案:

答案 0 :(得分:3)

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

您有三种可能性:

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

答案 1 :(得分:2)

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