npm install 指定版本的几个疑问

npm install 到底 install 的什么版本,@和^到底能不能锁住版本?

运行 npm install --force 时,安装的 react-native-reanimated 版本取决于 package.jsonpackage-lock.json 的情况:

  1. 如果 package.json 里是 "react-native-reanimated": "^3.4.2"
  • ^3.4.2 代表可以安装 3.x.x 但不会升级到 4.0.0 及以上。

  • 如果 package-lock.json 存在,并且锁定的是 3.4.2,则会安装 3.4.2

  • 如果 package-lock.json 不存在或被删除,则可能会安装 3.x.x 中的最新版本(比如 3.5.0,如果已经发布)。

阅读更多

npm publish 发包失败

npm发包失败,直接报错:

npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/react-native-use-toast - You do not have permission to publish "react-native-use-toast". Are you logged in as the correct user?
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
阅读更多

淘宝npm证书yarn报错(certificate has expired)

这尼玛大早上的来就给我报错,

error An unexpected error occurred: “https://registry.npm.taobao.org/@react-native-async-storage%2fasync-storage: certificate has expired”.

➜  chnqoo-recollections-mobile git:(main) yarn
yarn install v1.22.10
info No lockfile found.
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error An unexpected error occurred: "https://registry.npm.taobao.org/@react-native-async-storage%2fasync-storage: certificate has expired".
info If you think this is a bug, please open a bug report with the information provided in "/Users/sunyg/chnqoo-recollections-mobile/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
阅读更多