laraedit / laraedit-docker

Dockerized version of Laravel Homestead
MIT License
450 stars 78 forks source link

Laravel 5.4 / Laravel Mix Node.js version #48

Open artemverbo opened 7 years ago

artemverbo commented 7 years ago

Hi there,

Tried to bump one of the projects to 5.4 and use the new Laravel recommended way of assets management (Laravel Mix, purely based on Webpack, with no Gulp at all).

Seems like that requires newer versions of node/npm than currently available here.

> @ dev /opt/atlassian/pipelines/agent/build
> node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
/opt/atlassian/pipelines/agent/build/node_modules/laravel-mix/setup/webpack.config.js:120
        let extractPlugin = new plugins.ExtractTextPlugin(
        ^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

https://github.com/JeffreyWay/laravel-mix/issues/62

That's what I can currently see:

node v5.12.0
npm  v3.8.6

So assume it needs at least 6 and above...

artemverbo commented 7 years ago

UPD: Fixed temporary by adding this as a step in bitbucket pipelines, but I believe currently used nodejs install could be replaced with that in the Dockerfile.

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
newbie2005 commented 7 years ago

W: GPG error: http://repo.mysql.com trusty InRelease: The following signatures were invalid: KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C W: Failed to fetch http://ppa.launchpad.net/rwky/redis/ubuntu/dists/trusty/main/binary-amd64/Packages 403 Forbidden

It throw above error

newbie2005 commented 7 years ago

cd /etc/apt/source.list.d rm mysql.list rm nodesource.list rm rwky-redis-trusty.list curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - fixed error and run apt-get install -y nodejs

Installed node v7.10.1 npm 4.2.0

ninthday commented 6 years ago

Thanks you @artemverbo and @newbie2005 I modified nodesource.list in /etc/apt/source.list.d

replace:

deb https://deb.nodesource.com/node_5.x trusty main
deb-src https://deb.nodesource.com/node_5.x trusty main

to

deb https://deb.nodesource.com/node_8.x trusty main
deb-src https://deb.nodesource.com/node_8.x trusty main

then apt-get update && apt-get install -y nodejs.

node v8.9.1
npm 5.5.0
mrdenis73 commented 6 years ago

Can be in the repository a file package-lock.json? Different versions on different servers. There was a similar problem with the version node and npm tried different. The Laravel mix module did not take the necessary dependencies. screenshots GitlabCI http://joxi.ru/Y2LpgKnf9PQY32 http://joxi.ru/l2Znal0FwPEX82 - not laravel-mix dependencies http://joxi.ru/brREVQ7fJPYD7A (There are no modules in the folder) remove package-lock.json http://joxi.ru/a2XadKMC1BD3QA good (latest version node and npm).

Maybe you have this same stupid mistake. It is necessary to work with the same versions, but there are also such situations.

Could not compile the script on the servers (the old OP, the node required a new gcc, and that required a bunch of dependencies, the old node and npm did not work), they started using gitlab ci. Tried to run on local windows, linux mint, linux ubunta - all is well!