4

我在跑:

Laravel 混合版本:0.8.8

节点版本(7.5.0):

NPM 版本(4.1.2):

我正在尝试在我的 Laravel 5.4 项目中使用Firebase-adminnpm install --save 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/')
                ]
            }
        })
    ]
});
4

1 回答 1

0

我对 Laravel 有一个误解,你不能在默认的 Laravel 中运行 Node,反正也没有意义。如果您想使用 Firebase,您需要添加 javascript 版本。

于 2017-05-26T13:42:35.320 回答