我删除了我的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
发布评论
评论(3)
我遇到了同样的问题,并通过更改
bcrypt
版本中的package.json
手动到“ bcrypt”:“^5.0.1”,< /代码>。
然后再次运行
npm i
,并且不会遇到任何错误。I had the same issue and solved it by changing the
bcrypt
version in thepackage.json
file manually to"bcrypt": "^5.0.1",
.Then run
npm i
again and it won't get any error.清洁您的NPM缓存
,然后安装软件包
clean your npm cache
then install your packages
在软件包中制作“类型:模块”
make in the package "type: module"