error: while installing SDK dependency using npm
Closed this issue · 1 comments
sidhu18 commented
Issue Description
Installing the SDK dependency through npm fails with the below error message and the package is not downloaded.
error TS2688: Cannot find type definition file for 'react-native'.
More details
SDK version: 12.0.1
react: 18.2.0
react-native: 0.73.6
Detailed error message:
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /Users/sidharth.venadan/.nvm/versions/node/v18.3.0/bin/node /Users/sidharth.venadan/.nvm/versions/node/v18.3.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/sidharth.venadan/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > react-native-force@12.0.1 prepublish
npm ERR! > npm run build
npm ERR!
npm ERR!
npm ERR! > react-native-force@12.0.1 build
npm ERR! > tsc --build
npm ERR!
npm ERR! error TS2688: Cannot find type definition file for 'react-native'.
npm ERR! The file is in the program because:
npm ERR! Entry point of type library 'react-native' specified in compilerOptions
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm ERR! npm WARN deprecated @babel/plugin-proposal-optional-catch-binding@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
npm ERR! npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm ERR! npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm ERR! npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm ERR! npm WARN deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
Replication steps
- Add SDK dependency to package.json,
"react-native-force": "git+https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative#v12.0.1"
- Install the dependency by running
npm i
Possible fix
We were able to fix this issue by adding the "@types/react-native"
dependency to package.json and running npm install on the fork. PR with the changes for reference - #375
wmathurin commented
@types/react-native is deprecated starting (last version in 0.73.0) - see https://www.npmjs.com/package/@types/react-native
So the change above should no longer be needed.
Our dev branch already uses RN 0.74 and that will be in our upcoming release (MSDK 12.1.0).