错误:找不到模块“请求承诺”

问题描述 投票:0回答:3

我正在尝试在 Snowflake Server 中运行我的 NodeJS 代码。 代码没问题,但我收到以下回复:

`Error:` Cannot find module 'request-promise'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/server/auth/AuthController.js:10:10)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

我尝试在 stackoverflow 和其他网站上研究类似的问题,并得出以下解决方案: 运行命令

npm install request-premise --save

这显示以下输出:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/request-premise - Not found
npm ERR! 404 
npm ERR! 404  'request-premise@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-07-27T12_45_13_757Z-debug.log

请大家帮忙

node.js npm deprecated
3个回答
0
投票

您尝试安装的软件包已被弃用。 request-promise 已被弃用,因为它扩展了现已弃用的 request 包,请参阅 https://github.com/request/request/issues/3142

npm i request-promise

上面的包才是正确的安装方式


0
投票

也许您应该输入 request-promise 而不是 request-premise。 祝你好运。


0
投票

npm warn 已弃用 [email protected]:不再支持此库 npm warn deprecated [email protected]:请求已被弃用,请参阅 https://github.com/request/request/issues/3142 npm warn deprecated [email protected]:request-promise 已被弃用,因为它扩展了现已弃用的请求包,请参阅 https://github.com/request/request/issues/3142

22秒内添加了52个包 为什么会出现地狱警告......

© www.soinside.com 2019 - 2024. All rights reserved.