gpt4 book ai didi

javascript - IntelliJ 卸载了 connect-flash,现在无法再次安装

转载 作者:行者123 更新时间:2023-11-30 20:14:01 26 4
gpt4 key购买 nike

我是 node 新手,遇到了一个特殊问题。我正在尝试使用 passportjs 登录,我遇到了这个错误,其中 req.flash() 没有工作,即使我昨天使用它进行注册它说的是 req.flash() 在 Node 模型目录或类似目录中无法识别。

在尝试了多种方法让它工作之后,我想起了在我打开 i.js 时 IntelliJ 要求我运行一个 npm install 命令。所以我单击了事件日志并允许 IntelliJ 运行它,IntelliJ 重新启动并单击运行并出现错误。

module.js:549
throw err;
^
Error: Cannot find module 'connect-flash'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\My\Desktop\NodeApp\Test\app.js:8:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

所以我转到 node_modules 和 connect_flash,文件夹在那里,但上面有一个符号。

在下面的 IntelliJ 中

enter image description here

在下面的文件浏览器中

enter image description here

当我尝试在文件资源管理器中单击它时出现以下 Windows 错误

C:\Users\My\Desktop\NodeApp\Test\node_modules\connect-flash is not accessible The name of the file cannot be resolved by the system

所以我删除了它并尝试重新安装返回错误的npm install connect-flash

npm ERR! code ETARGET
npm ERR! notarget No matching version found for connect-flash@8
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\My\AppData\Roaming\npm-cache\_logs\2018-08-30T21_17_28_983Z-debug.log

生成的日志文件如下

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli
'install', 1 verbose cli 'connect-flash' ] 2 info using npm@5.6.0 3 info using node@v8.11.3 4 verbose npm-session 36d3535b3518b319 5 silly install loadCurrentTree 6 silly install readLocalPackageData 7 http fetch GET 200 https://registry.npmjs.org/connect-flash 22ms (from cache) 8 silly registry:manifest no matching version for connect-flash@8 in the cache. Forcing revalidation 9 http fetch GET 304 https://registry.npmjs.org/connect-flash 83ms (from cache) 10 silly fetchPackageMetaData error for connect-flash@8 No matching version found for connect-flash@8 11 verbose type range 12 verbose stack connect-flash: No matching version found for connect-flash@8 12 verbose stack at pickManifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\npm-pick-manifest\index.js:65:11) 12 verbose stack at fetchPackument.then.packument (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:52:18) 12 verbose stack at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23) 12 verbose stack at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31) 12 verbose stack at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18) 12 verbose stack at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10) 12 verbose stack at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18) 12 verbose stack at Async._drainQueue (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16) 12 verbose stack at Async._drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10) 12 verbose stack at Immediate.Async.drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14) 12 verbose stack at runCallback (timers.js:810:20) 12 verbose stack at tryOnImmediate (timers.js:768:5) 12 verbose stack at processImmediate [as _immediateCallback] (timers.js:745:5) 13 verbose cwd C:\Users\My\Desktop\NodeApp\Test 14 verbose Windows_NT 10.0.17134 15 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "connect-flash" 16 verbose node v8.11.3 17 verbose npm v5.6.0 18 error code ETARGET 19 error notarget No matching version found for connect-flash@8 20 error notarget In most cases you or one of your dependencies are requesting 20 error notarget a package version that doesn't exist. 21 verbose exit [ 1, true ]

我以前从未遇到过这样的问题,如果有任何帮助,我将不胜感激

最佳答案

我自己弄明白了,出于某种原因,IntelliJ 决定不再需要 pacckage.json 中的版本号。在我为版本包含 0.1.1 之后,我可以为其运行安装命令

关于javascript - IntelliJ 卸载了 connect-flash,现在无法再次安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52105579/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com