Wednesday, March 1, 2017

Dependancy were not found when using Firebase-admin in laravel

I'm running:

Laravel Mix Version: 0.8.8

Node Version (7.5.0):

NPM Version (4.1.2):

I'm trying to use Firebase-admin using npm install --save firebase-admin in my Laravel 5.4 project

When I do require('firebase-admin'); in my resources/assets/js/app.js then I run npm run dev This error shows up:

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

I have tried alias in my webpack.mix.js with no luck

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

I also tried to do this with no luck as well

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




via Faisal

Advertisement