[英]My app can't find my TypeScript package downloaded from the NPM registry (module not found)
[英]Why can't find package required on the "npm" registry
我在使用本教程视频React Native Web 完整应用程序教程 - 为 react-native 中的 iOS、Android 和 Web 构建锻炼应用程序时遇到问题。解决了我的问题。
我从这里下载了应用程序: git repo 。
尝试使用:
$ yarn
$ yarn install
$ npm install
$ npm config set @icons:registry https://registry.npmjs.org/
$ rm -rf node_modules
$ npm i https://github.com/Qix-/node-error-ex
$ curl 'https://registry.yarnpkg.com/@types/node/-/node-9.4.2.tgz'
但似乎没有任何效果,我不断收到此错误。
error Couldn't find package "@wow/common@1.0.0" required by "@wow/app@0.0.1" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "@wow/common@1.0.0" required by "react-native-web-workout-series@0.1.0" on the "npm" registry.
at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:721:66)
at new MessageError (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:750:123)
at PackageRequest.<anonymous> (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:36539:17)
at Generator.throw (<anonymous>)
at step (/usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:310:30)
at /usr/local/Cellar/yarn/1.22.4/libexec/lib/cli.js:323:13
at processTicksAndRejections (internal/process/task_queues.js:97:5)
或者我需要遵循的任何步骤来运行这个应用程序。 因为我想下载应用程序并编辑正文内容。
我尝试自己下载并测试它,它工作正常。
再次克隆它并按照以下步骤操作:
#After cloning enter the folder
cd react-native-web-series
#install all dependencies
yarn install
#Navigate to the web folder
cd packages/web
#start the app
yarn start
附言。 :如果一个项目使用 yarn 来运行npm
命令不是一个好主意,不要混合这两个
就我而言,原因是.npmrc
文件。
您可以重命名此文件
mv ~/.npmrc ~/.npmrc2
npx create-react-app my-app
并在安装后重命名。
mv ~/.npmrc2 ~/.npmrc
我在这里遇到了同样的问题。 正如@Dmitry Grinko 提到的,它与.npmrc 文件有关。
我之前使用了私有 npm 注册表,因此缺少一些 package。
使用以下注册表将通过该问题。
registry=https://registry.npmjs.org/
在终端中使用npm login
以登录您的 npm 注册表。
如果您使用的是 nvm
nvm 别名默认 14.18.0
在查看 git 存储库后 - 我认为也许你应该尝试在任何包(应用程序,通用,Web)中运行 npm i (或其他命令 - 我不是来自本地反应区域)到自身 - 就像我看到其中的任何一个有自己的package.json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.