调试/打包本地响应产量,“找不到模块'AsyncStorage'”

时间:2018-09-20 19:01:09

标签: typescript react-native visual-studio-code

我最近不得不重新安装VS Code,直到调试正常为止,但是在重新安装之后,无论何时尝试启动调试器或启动打包程序,我都遇到一个奇怪的错误。我有launch.json并安装了React Native Tools 0.6.17。我使用的是节点版本8.11.4,反应本机版本0.55.4和VS Code版本1.27.2。

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug in Exponent",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "exponent",
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        { 
            "name": "Debug Windows", 
            "program": "${workspaceRoot}/.vscode/launchReactNative.js", 
            "type": "reactnative", 
            "request": "launch", 
            "platform": "windows", 
            "sourceMaps": true, 
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Jest Tests",
            "program": "${workspaceRoot}\\node_modules\\jest\\bin\\jest.js",
            "args": [
                "-i"
            ],
            "preLaunchTask": "build",
            "internalConsoleOptions": "openOnSessionStart",
            "outFiles": [
                "${workspaceRoot}/dist/**/*"
            ],
            "envFile": "${workspaceRoot}/.env"
        }
    ]
}

每当我运行调试器或启动打包程序时,都会得到以下信息

module.js:549
    throw err;
    ^

Error: Cannot find module 'AsyncStorage'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.get AsyncStorage [as AsyncStorage] (e:\repos\Hiu\ReactP4\node_modules\react-native\Libraries\react-native\react-native-implementation.js:71:31)
    at Object.<anonymous> (e:\repos\Hiu\ReactP4\node_modules\asyncstorage-down\asyncstorage-core.js:3:43)
    at Module._compile (module.js:652:30)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .js] (e:\repos\Hiu\ReactP4\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (module.js:565:32)
[Error] Error: Could not start the packager.

我已经检查了react-native-implementation.js文件,在第71行上有get AsyncStorage() { return require('AsyncStorage'); },(sic)行,该行似乎是指AsyncStorage文件,它位于react-native \ Libraries \ Storage中

所有这些,为什么它找不到AsyncStorage,为什么包装有问题?

0 个答案:

没有答案