【问题标题】:expo start Cannot Find Module 'hoek'世博会开始找不到模块'hoek'
【发布时间】:2019-04-26 18:40:12
【问题描述】:

我安装了 expo-cli 并使用 expo init 启动项目。
然后我尝试使用expo start 开始项目。我收到一个错误:找不到模块 'hoek'

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@6.4.1
3 info using node@v11.2.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle empty-project-template@~prestart: empty-project-template@
6 info lifecycle empty-project-template@~start: empty-project-template@
7 verbose lifecycle empty-project-template@~start: unsafe-perm in lifecycle true
8 verbose lifecycle empty-project-template@~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\proje\hoek\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;D:\Matlab\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Users\Seçil.SECIL\AppData\Local\Microsoft\WindowsApps;C:\Users\Seçil.SECIL\AppData\Roaming\npm;C:\Users\Seçil.SECIL\AppData\Local\Yarn\bin
9 verbose lifecycle empty-project-template@~start: CWD: C:\proje\hoek
10 silly lifecycle empty-project-template@~start: Args: [ '/d /s /c', 'expo start' ]
11 silly lifecycle empty-project-template@~start: Returned: code: 1  signal: null
12 info lifecycle empty-project-template@~start: Failed to exec start script
13 verbose stack Error: empty-project-template@ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:978:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid empty-project-template@
15 verbose cwd C:\proje\hoek
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v11.2.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error empty-project-template@ start: `expo start`
22 error Exit status 1
23 error Failed at the empty-project-template@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我试过这些:

  • 删除 node_modules 文件夹并再次运行 npm install
  • npm clear cache 并运行 expo start
  • npm install hoekexpo start

没有什么能解决问题,我在启动 expo 项目时仍然遇到同样的错误。

这是我的 package.json

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo/vector-icons": "^8.0.0",
    "expo": "^31.0.2",
    "native-base": "^2.8.1",
    "react": "^16.6.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz",
    "react-native-sensors": "^4.1.0",
    "react-navigation": "^2.18.2"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.0.0",
    "schedule": "^0.4.0"
  }
}

【问题讨论】:

  • 删除你的锁文件并重新安装包
  • @RaajNadar 我删除了 package.json.lock 然后我运行 npm install。我遇到了同样的错误。
  • 我在使用 npm 时遇到了很多问题,所以尝试使用 yarn.. 检查是否有 node_modules/hoek 文件夹
  • 再试一步expo start -c这将清除缓存
  • @RaajNadar 我解决了这个问题。我的 expo-cli 包没有 hoek 节点模块。我使用 npm uninstall -g expo-cli 卸载 expo-cli 并重新安装 npm i -g expo-cli 缺少的节点模块返回到全局 expo-cli/node_modules 文件夹中。感谢您的帮助。

标签: react-native expo


【解决方案1】:

也许您需要使用npm install --save hoek 安装它? 您将忽略 --save 参数。这就是您的 package.json 文件中未列出依赖项的原因。

【讨论】:

  • 但这不应该抛出错误!因为包会下载到他的node_modules中
  • 我用 npm install --save hoek 安装了 hoek,但它没有解决我的问题。
  • @erkandemir 我的步骤和你一样:expo initnpm i --save hoek,然后是expo start。一切运行完美。您能否尝试安装 npm 的 reinstall 软件包:npm install reinstall -g。然后在你的应用文件夹中运行它:reinstall.
  • @KevinvanZyl 我在我的应用程序文件夹中运行 npm install reinstall -g 并开始展览。它不起作用。
  • @erkandemir 现在尝试运行reinstall。一旦应用程序完成重新安装,然后再次尝试expo start。我完全复制了您的 package.json 并顺利完成了您的步骤。
猜你喜欢
  • 1970-01-01
  • 2019-11-21
  • 2022-01-23
  • 1970-01-01
  • 2020-06-25
  • 1970-01-01
  • 2020-04-26
  • 1970-01-01
  • 2018-04-23
相关资源
最近更新 更多