hooks icon indicating copy to clipboard operation
hooks copied to clipboard

Can't install through npm

Open kevnw opened this issue 4 years ago • 11 comments

Question

image Trying to use the useDimensions library from @react-native-community/hooks but I can't install it. Any help?

kevnw avatar Oct 08 '20 06:10 kevnw

I have the exact same issue.

aradhya-gupta avatar Oct 08 '20 12:10 aradhya-gupta

Hmm, I'm having a hard time seeing how this specific package could have caused this. Are you seeing this with any other package, or just ours?

@kevnw it seems like you are running this on a Window filesystem from Linux, is that a correct assumption? Does it work if you install the package to e.g. /tmp/foobar.

@aradhya-gupta what operating system and file system are you using?

LinusU avatar Oct 08 '20 12:10 LinusU

@LinusU I'm using windows 10

aradhya-gupta avatar Oct 08 '20 12:10 aradhya-gupta

I'm getting the following error while compilation of my app:

While trying to resolve module @react-native-community/hooks from file C:\Users\Aradhya\Desktop\DoneWith\App.js, the package C:\Users\Aradhya\Desktop\DoneWith\node_modules\@react-native-community\hooks\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (C:\Users\Aradhya\Desktop\DoneWith\node_modules\@react-native-community\hooks\lib\index.js. Indeed, none of these files exist:

  • C:\Users\Aradhya\Desktop\DoneWith\node_modules@react-native-community\hooks\lib\index.js(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)
  • C:\Users\Aradhya\Desktop\DoneWith\node_modules@react-native-community\hooks\lib\index.js\index(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)

aradhya-gupta avatar Oct 08 '20 12:10 aradhya-gupta

I am also facing this issue with npm. It seems to be an issue specific to downloading with npm. yarn adding works perfectly. yarn add @react-native-community/hooks

randimaS avatar Nov 11 '20 19:11 randimaS

Facing the same issue with npm, any solution?

Mubashar-javed avatar Jan 05 '21 14:01 Mubashar-javed

I had a similar problem with npm install. For the moment I installed the package with yarn.

image

zhengfen avatar Jan 08 '21 07:01 zhengfen

Uninstalling and reinstalling the library fixed it for me, don't know what went wrong the first time though

Riamus78 avatar Mar 30 '21 21:03 Riamus78

use this command instead

npm install @react-native-community/hooks -f

or

yarn add @react-native-community/hooks

SiddheshDabholkar avatar Jul 04 '21 07:07 SiddheshDabholkar

SiddheshDabholkar That worked for me. Had the same issue

barenzimo avatar Jul 04 '21 21:07 barenzimo

Having the same issue, please help :/

tarunfy avatar Aug 24 '21 20:08 tarunfy