codingteam / Keter

A roguelike game in the SCP setting.
https://codingteam.github.io/Keter/
MIT License
14 stars 5 forks source link

Build error: "webpack: not found" #69

Closed Akon32 closed 7 years ago

Akon32 commented 7 years ago

When building 44bd7b798ba on Ubuntu 14.04, sbt fails with such message:

[info] Bundling the application with its NPM dependencies
[error] sh: 1: webpack: not found
[error] npm ERR! weird error 127
[error] npm WARN This failure might be due to the use of legacy binary "node"
[error] npm WARN For further explanations, please read
[error] /usr/share/doc/nodejs/README.Debian
[error]  
[error] npm ERR! not ok code 0

I had installed npm by apt-get, and tried to install nodejs-legacy in order to fix build. It didn`t helped.

ForNeVeR commented 7 years ago

Do you have any additional logs? Sometimes there's npm-debug.log in the directory you were running npm from.

I can't promise you that I'll be able to take a look at the issue today, but I'll definitely try to fix that ASAP. I consider that as a show-stopper.

Akon32 commented 7 years ago

There is no npm-debug.log file on my machine.

npm WARN This failure might be due to the use of legacy binary "node"

Both node and nodejs commands do start js interpreter, probably it`s not cause of problem.

Had anybody reproduced this issue?

ForNeVeR commented 7 years ago

Alright, for now I have done the following:

$ docker pull debian
$ docker run -i -t debian /bin/bash
# apt-get update
# apt-get install apt-transport-https # because otherwise it may fail on installing sbt
# # Starting from here, I'll follow the installation instructions from sbt site
# echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
# apt-get update
# apt-get install sbt
# # Install npm
# apt-get install npm
# # Check the build system
# npm --version
1.4.21 # oh god
# node --version
bash: node: command not found
# nodejs --version
v0.10.29 # oh my god

From that we can already conclude that nodejs and npm versions in the standard Debian repositories are terribly, extremely outdated. I'll follow with my investigation to see if we can do anything with that.

ForNeVeR commented 7 years ago

After that I've done the following:

# # Now let's build Keter
# git clone https://github.com/codingteam/Keter.git
# cd Keter
# sbt site
[error] /usr/bin/env: node: No such file or directory
[error]
[error] npm ERR! @ bundle: `webpack --config /Keter/target/scala-2.11/scalajs.webpack.config.js`
[error] npm ERR! Exit status 127
# # Alright, let's install this nodejs-legacy thing
# apt-get install nodejs-legacy
# sbt site # and it succeeded
# ls target/site
index.html  keter-opt-bundle.js.map  keter.js

As you can see, I have the project built successfully with that nodejs-legacy thing even on this shitty old outdated Node.js version, so nope, I can't reproduce your problem, sorry. Could you try to do the following immediately after the failed build?

# cd target/scala-2.11
# cat package.json # and show it to me
# npm run bundle # and show the logs
ForNeVeR commented 7 years ago

Ah, please note that I was using Debian 8.6 inside of the Docker container through the investigation:

# uname -a
Linux 5b0496cc786c 4.4.27-moby #1 SMP Wed Oct 26 14:21:29 UTC 2016 x86_64 GNU/Linux
# cat /etc/issue
Debian GNU/Linux 8 \n \l
# cat /etc/debian_version
8.6
Akon32 commented 7 years ago
$ cat package.json 
{
  "dependencies": {
    "rot-js": "0.6.2",
    "rot-js": "0.6.2"
  },
  "devDependencies": {
    "webpack": "1.13",
    "source-map-loader": "0.1.5",
    "concat-with-sourcemaps": "1.0.4"
  },
  "scripts": {
    "bundle": "webpack --config /home/akon/src/keter/target/scala-2.11/scalajs.webpack.config.js"
  }
}
$ npm run bundle

> @ bundle /home/akon/src/keter/target/scala-2.11
> webpack --config /home/akon/src/keter/target/scala-2.11/scalajs.webpack.config.js

sh: 1: webpack: not found
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0
ForNeVeR commented 7 years ago

Could you please execute ls node_modules/.bin there? And also npm bin.

Akon32 commented 7 years ago

There is node_modules/rot-js only.

ForNeVeR commented 7 years ago

That's interesting. What will it do if you run npm install?

Akon32 commented 7 years ago

After npm install and downloading a lot of packages, sbt site completed successfully. But after sbt clean, webpack is missing again.

ForNeVeR commented 7 years ago

That looks like a problem of scalajs-bundler. Could you please report the issue to them? I'm ready to participate.

Akon32 commented 7 years ago

Hope this problem will be solved after OS upgrade, hence "won`t fix".