遇到问题-index.android.js:找不到模块“ babel-plugin-decorators”

时间:2019-08-17 10:10:35

标签: android react-native babel babel-plugin

我在我的项目和babel中使用React-native 0.60,创建捆绑包时出现以下错误。

错误index.android.js:找不到模块“ babel-plugin-decorators”

Error: Cannot find module 'babel-plugin-decorators' from '/Users/shubhamgupta/Downloads/Israel_today-master-shubham'
    at Function.module.exports [as sync] (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/resolve/lib/sync.js:40:15)
    at resolveStandardizedName (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
    at resolvePlugin (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
    at loadPlugin (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
    at createDescriptor (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at items.map (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPluginDescriptors (/Users/shubhamgupta/Downloads/Israel_today-master-shubham/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)

** .babelrc -**

{
    "presets": ["react-native"],
    "sourceMaps": true,
    "plugins": [
        ["babel-plugin-transform-decorators-legacy", {}, "a"],
        ["babel-plugin-transform-decorators", {}, "b"],
        ["transform-decorators-legacy", {}, "c"],
        ["decorators", { "decoratorsBeforeExport": false }, "d"],
        ["@babel/plugin-proposal-decorators", { "legacy": true}],
    ]

}


{
    "presets": ["react-native"],
    "sourceMaps": true,
    "plugins": [
        ["babel-plugin-transform-decorators-legacy", {}, "a"],
        ["babel-plugin-transform-decorators", {}, "b"],
        ["transform-decorators-legacy", {}, "c"],
        ["decorators", { "decoratorsBeforeExport": false }, "d"],
        ["@babel/plugin-proposal-decorators", { "legacy": true}],
    ]

}

**.babelrc file -**

{
    "presets": ["react-native"],
    "sourceMaps": true,
    "plugins": [
        ["babel-plugin-transform-decorators-legacy", {}, "a"],
        ["babel-plugin-transform-decorators", {}, "b"],
        ["transform-decorators-legacy", {}, "c"],
        ["decorators", { "decoratorsBeforeExport": false }, "d"],
        ["@babel/plugin-proposal-decorators", { "legacy": true}],
    ]

}

我希望输出没有错误,但是显示错误。

0 个答案:

没有答案