ManoSeimas / manoseimas.lt

ManoSeimas.lt website source code.
http://manoseimas.lt/
GNU Affero General Public License v3.0
4 stars 3 forks source link

Frontend install instructions #158

Closed sirex closed 8 years ago

sirex commented 8 years ago

Currently there is no instructions on how to install frontend part and it is not included into Makefile.

After trying to run project with make run I got:

[Errno 2] No such file or directory: '/home/sirex/devel/other/manoseimas/manoseimas.lt/build'

I guess this error happens because make run outputs this:

> manoseimas.lt@0.2.0 build:hot-reload /home/sirex/devel/other/manoseimas/manoseimas.lt
> node webpack-server.js

module.js:340
    throw err;
          ^
Error: Cannot find module 'webpack'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/sirex/devel/other/manoseimas/manoseimas.lt/webpack-server.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
npm ERR! weird error 8
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

To fix that, I tried this pip install . command and after installing gazilion packages it ended up with this:

npm ERR! peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-dom@15.1.0 wants react@^15.1.0
npm ERR! peerinvalid Peer react-redux@4.4.5 wants react@^0.14.0 || ^15.0.0-0
npm ERR! peerinvalid Peer react-router@2.4.1 wants react@^0.14.0 || ^15.0.0

npm ERR! System Linux 3.13.0-85-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "."
npm ERR! cwd /home/sirex/devel/other/manoseimas/manoseimas.lt
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sirex/devel/other/manoseimas/manoseimas.lt/npm-debug.log
npm ERR! not ok code 0

What I'm doing wrong?

sirex commented 8 years ago

Just to satisfy my curiosity, I just counted how many packages pip install . installs. It installs 2816, that is insane. Also I found, that many packages where downloaded more than once, so unique number of dependencies is 1084.

Whole manoseimas.lt project's backend part have only 75 packages, including all debugging and testing tools.

sirex commented 8 years ago

After installing pip install . packages with error mentioned in task description, I get new error, after make run:

/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/precss/node_modules/postcss-partial-import/node_modules/fs-promise/node_modules/any-promise/any-promise.js:32
  throw new Error('Must install one of: '+libs.join());
        ^
Error: Must install one of: es6-promise,promise,native-promise-only,bluebird,rsvp,when,q
    at /home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/precss/node_modules/postcss-partial-import/node_modules/fs-promise/node_modules/any-promise/any-promise.js:32:9
    at Object.<anonymous> (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/precss/node_modules/postcss-partial-import/node_modules/fs-promise/node_modules/any-promise/any-promise.js:33:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/precss/node_modules/postcss-partial-import/node_modules/fs-promise/index.js:4:12)
    at Module._compile (module.js:456:26)
npm ERR! weird error 8
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
sirex commented 8 years ago

After installing promise with npm install promise and changing package.json like this:

diff --git a/package.json b/package.json
index 8fe6f2f..c7ed3c1 100644
--- a/package.json
+++ b/package.json
@@ -33,8 +33,8 @@
     "postcss-import": "^8.1.0",
     "postcss-loader": "^0.9.1",
     "precss": "^1.4.0",
-    "react": "~15.0.1",
-    "react-dom": "^15.0.1",
+    "react": "~15.1.0",
+    "react-dom": "^15.1.0",
     "react-hot-loader": "^1.3.0",
     "react-redux": "^4.4.5",
     "react-router": "^2.4.0",

I got new error:

ERROR in ./manoseimas/compatibility_test/client/index.jsx
Module build failed: Error: Couldn't find preset "stage-0" relative to directory "/home/sirex/devel/other/manoseimas/manoseimas.lt"
    at /home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:372:17
    at Array.map (native)
    at OptionManager.resolvePresets (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:364:20)
    at OptionManager.mergePresets (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:348:10)
    at OptionManager.mergeOptions (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:307:14)
    at OptionManager.addConfig (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:207:10)
    at OptionManager.findConfigs (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:413:16)
    at OptionManager.init (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:461:12)
    at File.initOptions (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/index.js:194:75)
    at new File (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/index.js:123:22)
    at Pipeline.transform (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/pipeline.js:45:16)
    at transpile (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-loader/index.js:14:22)
    at Object.module.exports (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-loader/index.js:88:12)
 @ multi compat_test
webpack: bundle is now VALID.
sirex commented 8 years ago

Also I tried to run this npm run build:

> manoseimas.lt@0.2.0 build /home/sirex/devel/other/manoseimas/manoseimas.lt
> ./node_modules/.bin/webpack --config webpack/webpack.prod.config.js

/home/sirex/devel/other/manoseimas/manoseimas.lt/webpack/webpack.prod.config.js:4
config.output.path = require('path').resolve('./bundles')
^
ReferenceError: config is not defined
    at Object.<anonymous> (/home/sirex/devel/other/manoseimas/manoseimas.lt/webpack/webpack.prod.config.js:4:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at module.exports (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/webpack/bin/convert-argv.js:80:13)
    at Object.<anonymous> (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/webpack/bin/webpack.js:39:40)
    at Module._compile (module.js:456:26)
npm ERR! weird error 8
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
sirex commented 8 years ago

Another error when running node_modules/.bin/webpack --config webpack/webpack.dev.config.js:

Hash: 555fe4758be691be03b3
Version: webpack 1.13.1
Time: 10704ms
                              Asset     Size  Chunks             Chunk Names
compat_test-555fe4758be691be03b3.js   618 kB       0  [emitted]  compat_test
                    react.bundle.js  2.48 MB       1  [emitted]  react
   [0] multi compat_test 52 bytes {0} [built] [1 error]
   [0] multi react 76 bytes {1} [built]
    + 331 hidden modules

ERROR in ../manoseimas/compatibility_test/client/index.jsx
Module build failed: Error: Couldn't find preset "stage-0" relative to directory "/home/sirex/devel/other/manoseimas/manoseimas.lt"
    at /home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:372:17
    at Array.map (native)
    at OptionManager.resolvePresets (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:364:20)
    at OptionManager.mergePresets (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:348:10)
    at OptionManager.mergeOptions (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:307:14)
    at OptionManager.addConfig (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:207:10)
    at OptionManager.findConfigs (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:413:16)
    at OptionManager.init (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/options/option-manager.js:461:12)
    at File.initOptions (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/index.js:194:75)
    at new File (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/file/index.js:123:22)
    at Pipeline.transform (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-core/lib/transformation/pipeline.js:45:16)
    at transpile (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-loader/index.js:14:22)
    at Object.module.exports (/home/sirex/devel/other/manoseimas/manoseimas.lt/node_modules/babel-loader/index.js:88:12)
 @ multi compat_test
sirex commented 8 years ago

Ok, finally, after installing npm install --save-dev babel-preset-stage-0 everything started to work!

chompomonim commented 8 years ago

Generally you should:

  1. npm install
  2. Make sure that you can run node not nodejs.
  3. If there is no /build folder, create it.

I think I will add this stuff into Makefile later on.

chompomonim commented 8 years ago

BTW, are you working on new_test branch? There should be already babel-preset-stage-0 added into packages.json

sirex commented 8 years ago

Yes, I'm working on new_test and no npm install did not worked. After installing babel-preset-stage-0, promise packages and upgrading react and react-dom packages it started to work. Now frontend part works.

chompomonim commented 8 years ago

Strange, everything is already there, and there are no your pushes: https://github.com/ManoSeimas/manoseimas.lt/blob/new_test/package.json

sirex commented 8 years ago

When I started to work there was no https://github.com/ManoSeimas/manoseimas.lt/commit/7513606ed160c7c5bdf72abd0dfe4b10d6d16f23 commit present, that actually does exactly same things, that I had to do. I was just lucky enough to get a broken version of the code.

I try to avoid to push changes to the repository, that can brake thinks for others. That's why there is no pushes from me, because I'm still working on couchdb decommissioning task.

chompomonim commented 8 years ago

So, can we close this task, or we're going to add npm install as part of Makefile? I think this is then only think we're missing there for now.

sirex commented 8 years ago

To avoid guessing what commands needs to be run, npm install should be added either to Makefile or HACKING.rst. Then this task can be closed.