在laravel中使用Firebase-admin时未找到依赖关系

时间:2017-03-01 20:48:05

标签: node.js laravel firebase laravel-elixir firebase-admin

我正在跑步:

Laravel Mix版本:0.8.8

节点版本(7.5.0):

NPM版本(4.1.2):

我尝试在我的Laravel 5.4项目中使用npm install --save firebase-admin Firebase-admin

当我在require('firebase-admin');resources/assets/js/app.js时,我会运行npm run dev此错误会显示:

These dependencies were not found:

* fs in ./~/firebase-admin/lib/auth/credential.js, ./~/request/lib/har.js
* net in ./~/firebase-admin/~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 3 others
* tls in ./~/firebase-admin/~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 1 other
* dns in ./~/firebase-admin/~/isemail/lib/isemail.js

To install them, you can run: npm install --save fs net tls dns

我在我的webpack.mix.js中尝试了别名而没有运气

mix.webpackConfig({
    resolve: {
        alias: {
            'firebase-admin': path.resolve(__dirname, './node_modules/firebase-admin')
        }
    }
});

我也尝试过这样做而没有运气

mix.webpackConfig({
    plugins: [
        new webpack.LoaderOptionsPlugin({
            options: {
                includePaths: [
                    path.resolve(__dirname, './node_modules/firebase-admin/')
                ]
            }
        })
    ]
});

1 个答案:

答案 0 :(得分:0)

我对Laravel产生了误解,你无法在默认的Laravel中运行Node,但它无论如何都没有意义。如果您想使用Firebase,则需要添加javascript版本。