问答

nodejs 运行报错 我的npm 安装了crypto 模块提示报错没有

作者:admin 2021-09-13 我要评论

:\ruishunode cipher.jsnternal/modules/cjs/loader.js:985 throw err; ^rror: Cannot find module 'crypto-js'equire stack: D:\ruishu\cipher.js[90m at Funct...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)
:\ruishu>node cipher.js
nternal/modules/cjs/loader.js:985
 throw err;
 ^

rror: Cannot find module 'crypto-js'
equire stack:
 D:\ruishu\cipher.js
[90m    at Function.Module._resolveFilename (internal/modules/cj
15)[39m
[90m    at Function.Module._load (internal/modules/cjs/loader.js
[90m    at Module.require (internal/modules/cjs/loader.js:1044:1
[90m    at require (internal/modules/cjs/helpers.js:77:18)[39m
   at Object.<anonymous> (D:\ruishu\cipher.js:1:16)
[90m    at Module._compile (internal/modules/cjs/loader.js:1158:
[90m    at Object.Module._extensions..js (internal/modules/cjs/l
)[39m
[90m    at Module.load (internal/modules/cjs/loader.js:1002:32)
[90m    at Function.Module._load (internal/modules/cjs/loader.js
[90m    at Function.executeUserEntryPoint [as runMain] (internal
n.js:74:12)[39m {
 code: [32m'MODULE_NOT_FOUND'[39m,

image.png

###

node 中使用 crypto 是不需要 npm 装的。

image.png

可以看到他已经是自带的模块了

###

nmp 不加 -g 管理的当前目录的依赖。

所以你换了目录,两个结果就没有关系了。

你需要到你运行 cipher.js 的目录去 npm install

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • nodejs 运行报错 我的npm 安装了crypto

    nodejs 运行报错 我的npm 安装了crypto

  • 站长工具的`识别服务器类型、页面类型`

    站长工具的`识别服务器类型、页面类型`

  • 在DolphinDB中怎么判断两张表的内容相

    在DolphinDB中怎么判断两张表的内容相

  • 为什么js await 会返回字符串,而不是Pr

    为什么js await 会返回字符串,而不是Pr

腾讯云代理商
海外云服务器