scotch-io / scotch-box

Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.
http://box.scotch.io
2.7k stars 547 forks source link

Can't access any sites including 192.168.33.10 after npm run watch #365

Closed cleanboy closed 6 years ago

cleanboy commented 6 years ago

Hi guys,

Bit of a wierd one here...I use webpack to develop my sites with scotchbox...works fine everywhere except for my desktop pc (i also use a laptop and a mac at work and both are fine)

The laptop and desktop are using linux.

The laptop is using mint and the desktop is using ubuntu...ubuntu is pretty much a fresh install.

So when I vagrant up everything works fine but then when I run npm run watch is when it dies for some reason? I can't access any of my websites or the default 192.168.33.10

I have developed sites in wordpress and processwire cms and both have the same issue so its nothing to do with that.

I have multiple sites running by adding them (in vagrant ssh) to /etc/apache2/sites-available.

The super wierd thing is that if i run vagrant up and then wait about 15 minutes its fine but if i run it straight away it kills it all.

It has also randomly just died on me in the middle of working.

The only thing that fixes it is restarting the operating system.

Vagrant reload does not give any errors and im not really sure where to look for errors for this.

Any help would be appreciated.

Below is my webpack.config.js if it helps although like i said it works fine on other computers...just is a wierdo on this one.

`var webpack = require('webpack'), path = require('path'), glob = require('glob-all'), ExtractTextPlugin = require("extract-text-webpack-plugin"), PurifyCSSPlugin = require('purifycss-webpack'), CleanWebpackPlugin = require('clean-webpack-plugin'), BuildManifestPlugin = require('./build/plugins/BuildManifestPlugin'), CopyWebpackPlugin = require('copy-webpack-plugin'), BrowserSyncPlugin = require('browser-sync-webpack-plugin'), inProduction = (process.env.NODE_ENV === 'production'); //glob = require('glob-all');

module.exports = { entry:{ app:'./ui-theme/js/app.js', vendor:[ //Add any JS libraries here by calling the parent folder name in node_modules. 'jquery', 'bootstrap-sass' ] }, output:{ path: path.resolve(dirname, './site/templates'), filename:'./scripts/[name].js' }, module:{ rules:[ { test: /.(woff|woff2|eot|ttf|svg)$/, use:{ loader: 'url-loader', options:{ limit:8192, name:'./fonts/[name].[ext]' } } }, { test: /.scss$/, use:ExtractTextPlugin.extract({ use: ['css-loader','sass-loader'], fallback:'style-loader' }) }, { test: /.js$/, exclude: /node_modules/, loader: "babel-loader" } ] }, watchOptions:{ ignored: /node_modules/ }, plugins:[ new ExtractTextPlugin('./styles/styles.css'), new PurifyCSSPlugin({ paths: glob.sync([ path.join(dirname, 'site/templates/*/.php'), path.join(__dirname, 'site/templates/*.php') ]), minimize:inProduction }), new webpack.LoaderOptionsPlugin({ minimize:inProduction }), new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery" }),

    // Use this when adding hashes to styles and scripts for caching
    // It will delete and recreate the folders specified though so be careful!
    /*new CleanWebpackPlugin(['dist'], {
        root:__dirname,
        verbose:true,
        dry:false
    }),*/

    new CopyWebpackPlugin([ // Add any libraries here that might be page specific and loaded using head.load
        {
            from:'node_modules/jquery-validation/dist/jquery.validate.min.js',
            to:'scripts/lib/'
        },
        {
            from:'node_modules/slick-carousel/slick/',
            to:'scripts/lib/slick/'
        }
    ], {
        ignore:[
            '*.scss',
            '*.less',
            '*.rb',
            '*.gif'
        ]
    }),

    new BrowserSyncPlugin({
        host: 'localhost',
        port: 3000,
        proxy: 'http://ace.local/', //this needs to be the local url for the website as defined by you
        files:[
            'site/templates/**/*.php',
            'site/templates/*.php',
            'ui-theme/scss/*.scss',
            'ui-theme/js/*.js'
        ]
    }),

    // This outputs the name of the files into a manifest.json file
    // Need to figure out the best way of re-writing header / footer files with these values.
    // See build/plugins for code.
    // new BuildManifestPlugin()
]

};

if(inProduction){ module.exports.plugins.push( new webpack.optimize.UglifyJsPlugin() ); } `

whatnickcodes commented 6 years ago

Maybe you are running out of memory. I would consider doing one Vagrantfile per project

On Mon, Jan 29, 2018 at 2:11 PM, Matthew Jonat notifications@github.com wrote:

Hi guys,

Bit of a wierd one here...I use webpack to develop my sites with scotchbox...works fine everywhere except for my desktop pc (i also use a laptop and a mac at work and both are fine)

The laptop and desktop are using linux.

The laptop is using mint and the desktop is using ubuntu...ubuntu is pretty much a fresh install.

So when I vagrant up everything works fine but then when I run npm run watch is when it dies for some reason? I can't access any of my websites or the default 192.168.33.10

I have developed sites in wordpress and processwire cms and both have the same issue so its nothing to do with that.

I have multiple sites running by adding them (in vagrant ssh) to /etc/apache2/sites-available.

The super wierd thing is that if i run vagrant up and then wait about 15 minutes its fine but if i run it straight away it kills it all.

It has also randomly just died on me in the middle of working.

The only thing that fixes it is restarting the operating system.

Vagrant reload does not give any errors and im not really sure where to look for errors for this.

Any help would be appreciated.

Below is my webpack.config.js if it helps although like i said it works fine on other computers...just is a wierdo on this one.

`var webpack = require('webpack'), path = require('path'), glob = require('glob-all'), ExtractTextPlugin = require("extract-text-webpack-plugin"), PurifyCSSPlugin = require('purifycss-webpack'), CleanWebpackPlugin = require('clean-webpack-plugin'), BuildManifestPlugin = require('./build/plugins/BuildManifestPlugin'), CopyWebpackPlugin = require('copy-webpack-plugin'), BrowserSyncPlugin = require('browser-sync-webpack-plugin'), inProduction = (process.env.NODE_ENV === 'production'); //glob = require('glob-all');

module.exports = { entry:{ app:'./ui-theme/js/app.js', vendor:[ //Add any JS libraries here by calling the parent folder name in node_modules. 'jquery', 'bootstrap-sass' ] }, output:{ path: path.resolve(dirname, './site/templates'), filename:'./scripts/[name].js' }, module:{ rules:[ { test: /.(woff|woff2|eot|ttf|svg)$/, use:{ loader: 'url-loader', options:{ limit:8192, name:'./fonts/[name].[ext]' } } }, { test: /.scss$/, use:ExtractTextPlugin.extract({ use: ['css-loader','sass-loader'], fallback:'style-loader' }) }, { test: /.js$/, exclude: /node_modules/, loader: "babel-loader" } ] }, watchOptions:{ ignored: /node_modules/ }, plugins:[ new ExtractTextPlugin('./styles/styles.css'), new PurifyCSSPlugin({ paths: glob.sync([ path.join(dirname, 'site/templates/*/ .php'), path.join(__dirname, 'site/templates/*.php') ]), minimize:inProduction }), new webpack.LoaderOptionsPlugin({ minimize:inProduction }), new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery" }),

// Use this when adding hashes to styles and scripts for caching
// It will delete and recreate the folders specified though so be careful!
/*new CleanWebpackPlugin(['dist'], {
    root:__dirname,
    verbose:true,
    dry:false
}),*/

new CopyWebpackPlugin([ // Add any libraries here that might be page specific and loaded using head.load
    {
        from:'node_modules/jquery-validation/dist/jquery.validate.min.js',
        to:'scripts/lib/'
    },
    {
        from:'node_modules/slick-carousel/slick/',
        to:'scripts/lib/slick/'
    }
], {
    ignore:[
        '*.scss',
        '*.less',
        '*.rb',
        '*.gif'
    ]
}),

new BrowserSyncPlugin({
    host: 'localhost',
    port: 3000,
    proxy: 'http://ace.local/', //this needs to be the local url for the website as defined by you
    files:[
        'site/templates/**/*.php',
      'site/templates/*.php',
        'ui-theme/scss/*.scss',
        'ui-theme/js/*.js'
    ]
}),

// This outputs the name of the files into a manifest.json file
// Need to figure out the best way of re-writing header / footer files with these values.
// See build/plugins for code.
// new BuildManifestPlugin()

]

};

if(inProduction){ module.exports.plugins.push( new webpack.optimize.UglifyJsPlugin() ); } `

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scotch-io/scotch-box/issues/365, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-U6yNaFoWZjThlFRKjphDkTouLZJDAks5tPhfkgaJpZM4RxMnj .

-- Nicholas V. Cerminara T: 702.485.0853 E: nick@scotch.io

cleanboy commented 6 years ago

I highly doubt it although I have plenty of memory in my computer...how do I assign more to scotchbox?

Also as previously stated its a fresh install of ubuntu and until an hour ago I only had one project on there anyway.

My laptop has half the memory that my desktop does and has four or five previous projects running in the same scotchbox vagrant with no issues whatsoever. At work on my mac I have about 20 different projects running on that thing with no issues (its the same set up I have at home) and there is only 8gb of ram on that thing.

whatnickcodes commented 6 years ago

Maybe the VM is running out of memory?

TBH I'm not sure what the answer is here. Maybe someone can figure out what's going on?

cleanboy commented 6 years ago

Yeah I understood what you were saying...which is why i asked how I give it more? I assume its got a default setting of a certain amount that I can hopefully change?

whatnickcodes commented 6 years ago
config.vm.provider "virtualbox" do |v|

    v.memory = 4096

    v.cpus = 4

end

Maybe something like this?

cleanboy commented 6 years ago

Well the problem hasn't been solved but I figured out what it is....apache randomly keeps stopping and I don't know why. So if it does i have to vagrant ssh and do a sudo service apache2 start. I have no idea why this is happening but at least I found a quicker fix than having to restart every time.

babita-web commented 3 years ago

Hi I am having same problem. but this apache restart did not worked for me, any other solution please? I am working with wordpress and shopware simultaneously and after i run npm install now my local shopware(192.168.33.10) server is not responding.

Thank you in advance