Compiling Assets / Laravel 5.4 / Ubuntu 14.04 & 16.04

Check globally installed packages:

npm ls -g –depth=0

You do not need any globally installed NPM packages to compile these assets, so if you installed any because of this, go ahead and remove them now: npm uninstall -g [package]

Check your npm cache:

npm cache ls

If there’s anything in there, clear it:

npm cache clean

Also remove the node_modules folder in your current project.

rm -rf ./node_modules

Check your Nodejs version:

nodejs -v

If you’re not on 6.x.x, uninstall nodejs now:

sudo apt-get remove nodejs -y

Now prepare and install nodeJS  6, instructions for other versions are in the referenced article below.

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash – sudo apt-get install -y nodejs

now one last note, you need to install node-sass, for some reason it’s not in the package.json but it’s needed and you’ll get an error of missing folder.

npm i node-sass

Now navigate to your project folder and run: npm run prod

 

 

 

References:

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions