npm安装失败由于bcrypt错误

发布于 2025-02-11 06:40:03 字数 4872 浏览 1 评论 0 原文

我删除了我的node_modules文件夹以解决以前的错误,现在我陷入了另一个错误,我什至忘记了初始错误。每次尝试运行NPM安装或尝试安装BCRypt时,我都会遇到相同的错误。

错误:

    npm ERR! code 1
npm ERR! path C:\Users\user\Documents\react-native\rein\node_modules\bcrypt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! node:internal/modules/cjs/loader:361
npm ERR!       throw err;
npm ERR!       ^
npm ERR!
npm ERR! Error: Cannot find module 'C:\Users\user\Documents\react-native\rein\node_modules\set-blocking\index.js'. Please verify that the package.json has a valid "main" entry
npm ERR!     at tryPackage (node:internal/modules/cjs/loader:353:19)
npm ERR!     at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1005:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR!     at Object.<anonymous> (C:\Users\user\Documents\react-native\rein\node_modules\npmlog\log.js:8:19)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   path: 'C:\\Users\\user\\Documents\\react-native\\rein\\node_modules\\set-blocking\\package.json',
npm ERR!   requestPath: 'set-blocking'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-06-28T19_34_30_960Z-debug-0.log

我尝试删除我的软件包 - 锁。

我被告知要运行此代码 npm install-global-生产Windows-Build-tools 在根据他们的[Github Wiki] [1]安装BCRypt之前运行powershell作为管理员)从未完成。它只是说以28 完成,并且永远不会完成。我现在被困并沮丧。 我同样尝试安装 set-blocking ,即使我不知道它是什么,但是我看到错误说该模块丢失了,所以我尝试安装它,但仍然无法使用。给了我同样的错误,但是这次说丢失了一个不同的模块。

npm ERR! code 7
npm ERR! path C:\Users\user\Documents\react-native\rein\node_modules\bcrypt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | win32 | x64
npm ERR! node-pre-gyp ERR! UNCAUGHT EXCEPTION 
npm ERR! node-pre-gyp ERR! stack Error: Cannot find module 'C:\Users\user\Documents\react-native\rein\node_modules\whatwg-url\lib\public-api.js'. Please verify that the package.json has a valid "main" entry
npm ERR! node-pre-gyp ERR! stack     at tryPackage (node:internal/modules/cjs/loader:353:19)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
npm ERR! node-pre-gyp ERR! stack     at Module.require (node:internal/modules/cjs/loader:1005:19)
npm ERR! node-pre-gyp ERR! stack     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR! node-pre-gyp ERR! stack     at Object.<anonymous> (C:\Users\user\Documents\react-native\rein\node_modules\@mapbox\node-pre-gyp\node_modules\node-fetch\lib\index.js:10:33)
npm ERR! node-pre-gyp ERR! stack     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR! node-pre-gyp ERR! stack     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR! node-pre-gyp ERR! stack     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.18362
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\Documents\\react-native\\rein\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\user\Documents\react-native\rein\node_modules\bcrypt
npm ERR! node-pre-gyp ERR! node -v v16.13.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-06-28T18_28_13_176Z-debug-0.log

现在我很困惑,这变得痛苦了。请有人知道我可以做什么,因为我尽了我可能的选择。 [1]:

I deleted my node_modules folder in order to fix a previous error and now I'm stuck in another one and another one, I've even forgotten the initial error. Every time I try to run npm install or try to install bcrypt I get the same error.

Error:

    npm ERR! code 1
npm ERR! path C:\Users\user\Documents\react-native\rein\node_modules\bcrypt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! node:internal/modules/cjs/loader:361
npm ERR!       throw err;
npm ERR!       ^
npm ERR!
npm ERR! Error: Cannot find module 'C:\Users\user\Documents\react-native\rein\node_modules\set-blocking\index.js'. Please verify that the package.json has a valid "main" entry
npm ERR!     at tryPackage (node:internal/modules/cjs/loader:353:19)
npm ERR!     at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1005:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR!     at Object.<anonymous> (C:\Users\user\Documents\react-native\rein\node_modules\npmlog\log.js:8:19)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   path: 'C:\\Users\\user\\Documents\\react-native\\rein\\node_modules\\set-blocking\\package.json',
npm ERR!   requestPath: 'set-blocking'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-06-28T19_34_30_960Z-debug-0.log

I have tried deleting my package-lock.json and specifying a main entry in my package.json but nothing yet.

I was told to run this code npm install --global --production windows-build-tools before installing bcrypt according to their [github wiki][1] but everytime I try to install it, (I run powershell as admin) It never completes. It just says completed in 28 and never finishes. I am stuck now and frustrated.
I equally tried to install set-blocking even though I have no idea what it was but I saw the error say the module was missing so I tried installing it but still didn't work. Gave me the same exact error but this time said a different module was missing.

npm ERR! code 7
npm ERR! path C:\Users\user\Documents\react-native\rein\node_modules\bcrypt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | win32 | x64
npm ERR! node-pre-gyp ERR! UNCAUGHT EXCEPTION 
npm ERR! node-pre-gyp ERR! stack Error: Cannot find module 'C:\Users\user\Documents\react-native\rein\node_modules\whatwg-url\lib\public-api.js'. Please verify that the package.json has a valid "main" entry
npm ERR! node-pre-gyp ERR! stack     at tryPackage (node:internal/modules/cjs/loader:353:19)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
npm ERR! node-pre-gyp ERR! stack     at Module.require (node:internal/modules/cjs/loader:1005:19)
npm ERR! node-pre-gyp ERR! stack     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR! node-pre-gyp ERR! stack     at Object.<anonymous> (C:\Users\user\Documents\react-native\rein\node_modules\@mapbox\node-pre-gyp\node_modules\node-fetch\lib\index.js:10:33)
npm ERR! node-pre-gyp ERR! stack     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR! node-pre-gyp ERR! stack     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR! node-pre-gyp ERR! stack     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.18362
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\Documents\\react-native\\rein\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\user\Documents\react-native\rein\node_modules\bcrypt
npm ERR! node-pre-gyp ERR! node -v v16.13.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-06-28T18_28_13_176Z-debug-0.log

Now I'm confused and it's becoming a pain in the ass. Please does anyone have any idea what I can do as I've tried every option I can.
[1]: https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#microsoft-windows

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

む无字情书 2025-02-18 06:40:03

我遇到了同样的问题,并通过更改 bcrypt 版本中的 package.json 手动到“ bcrypt”:“^5.0.1”,< /代码>。

然后再次运行 npm i ,并且不会遇到任何错误。

I had the same issue and solved it by changing the bcrypt version in the package.json file manually to "bcrypt": "^5.0.1",.

Then run npm i again and it won't get any error.

寂寞美少年 2025-02-18 06:40:03

清洁您的NPM缓存

npm cache clean --force

,然后安装软件包

clean your npm cache

npm cache clean --force

then install your packages

好多鱼好多余 2025-02-18 06:40:03

在软件包中制作“类型:模块”

make in the package "type: module"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文