Help : Webpack and React

Hii All…

Im stuck on installing webpack and react… when i run “foreman start -f Procfile.static” its always show a lot of NPM error… can you give me a tutorial how to configure webpack and react on sharetribe installation?
Note : im totally noob

Thanks for help.

Hi!

First of all, you should have the correct version of Node.js installed on your machine. The supported version can be seen in the .nvmrc file in the repository root. As of now, for the latest 5.7.1 release, the required version is 6.1. I suggest using nvm:

nvm install v6.1
nvm alias default 6.1

Now you can verify your Node.js version with:

node -v

After that, you should run npm install to get the latest dependencies. You should not worry about Webpack or React if you don’t intend to develop the UI further from here.

If you’ve ran npm install already before and you have to change your Node.js version (or if you update Node.js version some time in the future), you should make sure the installed dependencies have been rebuilt with the correct Node.js version with:

cd client/
npm install
npm prune # removes old unused dependencies
npm rebuild # recompiles all possible C++ addons that might need change after Node.js has been updated

Hope this helps!

  • Kimmo
3 Likes

Solved… im forgot to cd client/ that package.json in this folder…
Thanks

1 Like

after intsalling nvm and v6.1 when i run npm install this is what i get , any help

undefined postinstall /home/john/sharetribe
cd client && npm install

npm WARN optional Skipping failed optional dependency /babel-cli/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN optional Skipping failed optional dependency /webpack/watchpack/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12

@wolfieorama That is just a warning from an optional dependency that is apparently only used with certain operating systems and/or architectures. See: https://github.com/paulmillr/chokidar/issues/425

You should be able to ignore those warnings, if they don’t cause any other problems.

  • Kimmo
1 Like

Hi,
we have similiar problems when trying to run sharetribe in production mode and precompiling assets. I already put all details into a related issue on github but no responses so far: https://github.com/sharetribe/sharetribe/issues/2037#issuecomment-224053350

We strictly followed the installation instructions, all versions (node, npm) are matching the requirements and everything else looks good so far. Only the generation of the assets causes lots of troubles and basically prevents us from proceeding and using sharetribe in general on our own server.

Any help is highly appreciated :slight_smile:

Cheers,
Raik

1 Like

@kite2go Sorry to hear that this is causing you major troubles. After we introduced React on Rails and the Webpack compilation step to the installation process, we’ve received number of bug reports from people that the JS-compilation crashes in certain environments. This is a major head-ache for us and honestly we don’t have a clear understanding how to fix these issues.

We are trying to find a solution, but it seems that it’s not that easy. Any help is highly appreciated!

I believe I might be having this issue - here’s an example of the errors that are thrown when I run “foreman start -f Procfile.static”:

npm ERR! @ build:dev:server: 'webpack -w --config webpack.server.config.js'
npm ERR! @ build:dev:client: 'webpack -w --config webpack.client.config.js'
npm ERR! npm owner ls
npm ERR! webpack -w --config webpack.server.config.js
npm ERR! webpack -w --config webpack.client.config.js

Is there anything I’m doing wrong? I’ve tried to follow the installation instructions exactly - I’m on a DigitalOcean droplet running 16.04 if that helps.

Which version of Node.js do you have? Did npm install run sucessfully?

  • Kimmo

I have problem to install sharetribe on digitalocean with ubuntu 16 x64 with instruction at https://github.com/sharetribe/sharetribe/blob/master/README.md#installation.

I got following errors when start server. I have nmp install success. Please help.

dev@ubuntu16-wegain:~/sharetribe$ nvm install v6.9.0
v6.9.0 is already installed.
Now using node v6.9.0 (npm v4.1.1)
dev@ubuntu16-wegain:~/sharetribe$ npm install

undefined postinstall /home/dev/sharetribe
cd client && npm install

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
dev@ubuntu16-wegain:~/sharetribe$ npm prune
dev@ubuntu16-wegain:~/sharetribe$ npm rebuild
dev@ubuntu16-wegain:~/sharetribe$ foreman start -f Procfile.static
06:13:00 rails.1 | started with pid 2731
06:13:00 rails-client-assets.1 | started with pid 2732
06:13:00 rails-server-assets.1 | started with pid 2734
06:13:00 rails.1 | Waiting for app/assets/webpack/server-bundle.js…
06:13:00 rails-client-assets.1 | Skipping routes export task. Routes file ./client/app/routes/routes.js exists already.
06:13:00 rails.1 | app/assets/webpack/server-bundle.js found
06:13:00 rails-server-assets.1 | Skipping translation export task. Translation bundle ./client/app/i18n/all.js exists already.
06:13:00 rails-server-assets.1 | Waiting for client/app/routes/routes.js…
06:13:00 rails-server-assets.1 | client/app/routes/routes.js found
06:13:02 rails-server-assets.1 |
06:13:02 rails-server-assets.1 | > @ build:dev:server /home/dev/sharetribe/client
06:13:02 rails-server-assets.1 | > npm run ensure-node-version && webpack -w --config webpack.server.config.js
06:13:02 rails-server-assets.1 |
06:13:02 rails-client-assets.1 |
06:13:02 rails-client-assets.1 | > @ build:dev:client /home/dev/sharetribe/client
06:13:02 rails-client-assets.1 | > npm run ensure-node-version && webpack -w --config webpack.client.config.js
06:13:02 rails-client-assets.1 |
06:13:05 rails-server-assets.1 |
06:13:05 rails-server-assets.1 | > @ ensure-node-version /home/dev/sharetribe/client
06:13:05 rails-server-assets.1 | > check-node-version --package
06:13:05 rails-server-assets.1 |
06:13:05 rails-client-assets.1 |
06:13:05 rails-client-assets.1 | > @ ensure-node-version /home/dev/sharetribe/client
06:13:05 rails-client-assets.1 | > check-node-version --package
06:13:05 rails-client-assets.1 |
06:13:07 rails-server-assets.1 | node: v6.9.0
06:13:07 rails-server-assets.1 | npm: v4.1.1
06:13:07 rails-client-assets.1 | node: v6.9.0
06:13:07 rails-client-assets.1 | npm: v4.1.1
06:13:10 rails-client-assets.1 | Webpack dev build for Rails
06:13:31 rails.1 | [2017-01-20 06:13:31] INFO WEBrick 1.3.1
06:13:31 rails.1 | [2017-01-20 06:13:31] INFO ruby 2.3.1 (2016-04-26) [x86_64-linux]
06:13:31 rails.1 | [2017-01-20 06:13:31] INFO WEBrick::HTTPServer#start: pid=2736 port=3000
06:13:39 rails-client-assets.1 | Killed
06:13:39 rails-client-assets.1 |
06:13:39 rails-client-assets.1 | npm ERR! Linux 4.4.0-59-generic
06:13:39 rails-client-assets.1 | npm ERR! argv “/home/dev/.nvm/versions/node/v6.9.0/bin/node” “/home/dev/.nvm/versions/node/v6.9.0/bin/npm” “run” “build:dev:client”
06:13:39 rails-client-assets.1 | npm ERR! node v6.9.0
06:13:39 rails-client-assets.1 | npm ERR! npm v4.1.1
06:13:39 rails-client-assets.1 | npm ERR! code ELIFECYCLE
06:13:39 rails-client-assets.1 | npm ERR! @ build:dev:client: npm run ensure-node-version && webpack -w --config webpack.client.config.js
06:13:39 rails-client-assets.1 | npm ERR! Exit status 137
06:13:39 rails-client-assets.1 | npm ERR!
06:13:39 rails-client-assets.1 | npm ERR! Failed at the @ build:dev:client script ‘npm run ensure-node-version && webpack -w --config webpack.client.config.js’.
06:13:39 rails-client-assets.1 | npm ERR! Make sure you have the latest version of node.js and npm installed.
06:13:39 rails-client-assets.1 | npm ERR! If you do, this is most likely a problem with the package,
06:13:39 rails-client-assets.1 | npm ERR! not with npm itself.
06:13:39 rails-client-assets.1 | npm ERR! Tell the author that this fails on your system:
06:13:39 rails-client-assets.1 | npm ERR! npm run ensure-node-version && webpack -w --config webpack.client.config.js
06:13:39 rails-client-assets.1 | npm ERR! You can get information on how to open an issue for this project with:
06:13:39 rails-client-assets.1 | npm ERR! npm bugs
06:13:39 rails-client-assets.1 | npm ERR! Or if that isn’t available, you can get their info via:
06:13:39 rails-client-assets.1 | npm ERR! npm owner ls
06:13:39 rails-client-assets.1 | npm ERR! There is likely additional logging output above.
06:13:39 rails-client-assets.1 |
06:13:39 rails-client-assets.1 | npm ERR! Please include the following file with any support request:
06:13:39 rails-client-assets.1 | npm ERR! /home/dev/sharetribe/client/npm-debug.log
06:13:40 rails-client-assets.1 | exited with code 1
06:13:40 system | sending SIGTERM to all processes
06:13:40 rails.1 | terminated by SIGTERM
06:13:40 rails-server-assets.1 | terminated by SIGTERM
dev@ubuntu16-wegain:~/sharetribe$