Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in setting up local dev #60

Closed
ajayns opened this issue Jan 15, 2018 · 21 comments
Closed

Errors in setting up local dev #60

ajayns opened this issue Jan 15, 2018 · 21 comments

Comments

@ajayns
Copy link
Contributor

ajayns commented Jan 15, 2018

To setup the development environment, I've followed the steps in README.md.
The command yarn returns the following errors.

yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.2: The platform "linux" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/5] ⠠ waiting...
[2/5] ⠠ uws
[3/5] ⠠ phantomjs-prebuilt
[4/5] ⠠ node-sass
error /media/ajayns/Projects/Code/xPR/plone-react/node_modules/phantomjs: Command failed.
Exit code: 1
Command: sh
Arguments: -c node install.js
Directory: /media/ajayns/Projects/Code/xPR/plone-react/node_modules/phantomjs
Output:
PhantomJS not found on PATH
Phantom installation failed TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.join (path.js:1251:7)
    at findSuitableTempDirectory (/media/ajayns/Projects/Code/xPR/plone-react/node_modules/phantomjs/install.js:127:30)
    at /media/ajayns/Projects/Code/xPR/plone-react/node_modules/phantomjs/install.js:476:19
    at nextTickCallback (/media/ajayns/Projects/Code/xPR/plone-react/node_modules/kew/kew.js:47:28)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9) TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.join (path.js:1251:7)
    at findSuitableTempDirectory (/media/ajayns/Projects/Code/xPR/plone-react/node_modules/phantomjs/install.js:127:30)
    at /media/ajayns/Projects/Code/xPR/plone-react/node_modules/phantomjs/install.js:476:19
    at nextTickCallback (/media/ajayns/Projects/Code/xPR/plone-react/node_modules/kew/kew.js:47:28)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

The backend setup also seems to return a few errors.
Running ./bin/buildout

Getting distribution for 'mr.developer==1.34'.
Got mr.developer 1.34.
Getting distribution for 'zc.buildout==2.5.2'.
While:
  Installing.
  Loading extensions.
  Getting distribution for 'zc.buildout==2.5.2'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg/zc/buildout/buildout.py", line 2123, in main
    getattr(buildout, command)(args)
  File "/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg/zc/buildout/buildout.py", line 637, in install
    self._load_extensions()
  File "/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg/zc/buildout/buildout.py", line 1163, in _load_extensions
    newest=self.newest, allow_hosts=self._allow_hosts)
  File "/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg/zc/buildout/easy_install.py", line 920, in install
    return installer.install(specs, working_set)
  File "/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg/zc/buildout/easy_install.py", line 721, in install
    for dist in self._get_dist(req, ws):
  File "/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg/zc/buildout/easy_install.py", line 577, in _get_dist
    dist = self._env.best_match(requirement, ws)
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1111, in best_match
    dist = working_set.find(req)
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 715, in find
    raise VersionConflict(dist, req)
VersionConflict: (zc.buildout 2.10.0 (/media/ajayns/Projects/Code/xPR/plone-react/api/eggs/zc.buildout-2.10.0-py2.7.egg), Requirement.parse('zc.buildout==2.5.2'))

This error also meants the ./bin/instance is never created only.

Still running the dev server with all these errors shows this: (Just added this more info for debug)

Something went wrong: Invalid token specified: Cannot read property 'replace' of undefined

@tisto Please help me out here!

@tulikavijay
Copy link

tulikavijay commented Jan 15, 2018

TMPDIR=/tmp yarn add phantomjs-prebuilt for yarn solves the issue for me @ajayns @tisto

@ajayns
Copy link
Contributor Author

ajayns commented Jan 15, 2018

@tulikavijay Hey! thanks for the reply, but then could you please tell me what that command does? And also does it fix the backend api issues that I'm facing as well?

@ajayns
Copy link
Contributor Author

ajayns commented Jan 15, 2018

I did a rerun of all the installs, the command @tulikavijay suggested seems to fix the issue with phantomjs, I feel this should be documented if more people are facing the same issue. Also, the commits recently made has solved the backend issues and it seems to be up and running.

But then, I still seem to be facing the error on the browser when running yarn dev with the backend running. Any suggestions? @tisto

@tulikavijay
Copy link

tulikavijay commented Jan 16, 2018

I think this should do it for installing backend.
@ajayns follow the steps for backend installation again, this time do the following :

$ cd api
$ python bootstrap-buildout.py -v 2.5.2
$ ./bin/buildout

Edit : this was before i saw the latest commit, so the PR and comment are not needed.

@tulikavijay
Copy link

@tisto @ajayns
TMPDIR=/tmp yarn add phantomjs-prebuilt is a hack for phantomjs, and i am not sure how we can include this since its very specific.
There have been issues with phantomjs for a while, the solution given by yarn is usually to drop it and go for Chrome headless.
Here's a thread : Bug. Yarn couldn't build package phantomjs. npm could.
there are more threads on github regarding this and its not solved yet, so i am not sure what we should do ...

@tulikavijay
Copy link

I too ran into an error on yarn dev, here's the log:

yarn run v1.3.2
$ NODE_ENV=development npm-run-all dev:build
$ npm-run-all -ln clear:dist prepare:dev:build i18n:build development
[clear:dist       ] 
[clear:dist       ] > @plone/plone-react@0.4.0 clear:dist /home/tux/workspace/plone-react/package.json
[clear:dist       ] > rm -rf dist 
[clear:dist       ] 
[clear:dist       ] $ rm -rf dist
[prepare:dev:build] 
[prepare:dev:build] > @plone/plone-react@0.4.0 prepare:dev:build /home/tux/workspace/plone-react/package.json
[prepare:dev:build] > universal-webpack --settings ./webpack/universal-webpack-settings.js prepare 
[prepare:dev:build] 
[prepare:dev:build] $ universal-webpack --settings ./webpack/universal-webpack-settings.js prepare
[i18n:build       ] 
[i18n:build       ] > @plone/plone-react@0.4.0 i18n:build /home/tux/workspace/plone-react/package.json
[i18n:build       ] > babel-node scripts/i18n.js build 
[i18n:build       ] 
[i18n:build       ] $ babel-node scripts/i18n.js build
[development      ] 
[development      ] > @plone/plone-react@0.4.0 development /home/tux/workspace/plone-react/package.json
[development      ] > npm-run-all -ln --parallel build:dev:client build:dev:server run:dev:server 
[development      ] 
[development      ] $ npm-run-all -ln --parallel build:dev:client build:dev:server run:dev:server
[development      ] [build:dev:client] 
[development      ] [build:dev:client] > @plone/plone-react@0.4.0 build:dev:client /home/tux/workspace/plone-react/package.json
[development      ] [build:dev:client] > better-npm-run run_dev_client 
[development      ] [build:dev:client] 
[development      ] [build:dev:server] 
[development      ] [build:dev:server] > @plone/plone-react@0.4.0 build:dev:server /home/tux/workspace/plone-react/package.json
[development      ] [build:dev:server] > better-npm-run build_dev_server 
[development      ] [build:dev:server] 
[development      ] [run:dev:server  ] 
[development      ] [run:dev:server  ] > @plone/plone-react@0.4.0 run:dev:server /home/tux/workspace/plone-react/package.json
[development      ] [run:dev:server  ] > better-npm-run run_dev_server 
[development      ] [run:dev:server  ] 
[development      ] [build:dev:client] $ better-npm-run run_dev_client
[development      ] [run:dev:server  ] $ better-npm-run run_dev_server
[development      ] [build:dev:server] $ better-npm-run build_dev_server
[development      ] [build:dev:client] running better-npm-run in /home/tux/workspace/plone-react
[development      ] [build:dev:client] Executing script: run_dev_client
[development      ] [build:dev:client] 
[development      ] [run:dev:server  ] running better-npm-run in /home/tux/workspace/plone-react
[development      ] [run:dev:server  ] Executing script: run_dev_server
[development      ] [run:dev:server  ] 
[development      ] [build:dev:client] to be executed: babel-node webpack/server.dev.js 
[development      ] [run:dev:server  ] to be executed: nodemon --watch ./src/server.jsx --watch ./src --watch ./dist/server.js ./src/start-server.js --exec babel-node 
[development      ] [build:dev:server] running better-npm-run in /home/tux/workspace/plone-react
[development      ] [build:dev:server] Executing script: build_dev_server
[development      ] [build:dev:server] 
[development      ] [build:dev:server] to be executed: webpack --config ./webpack/webpack.config.server.dev.entry.js --watch --hot --colors --display-error-details 
[development      ] [run:dev:server  ] [nodemon] 1.12.1
[development      ] [run:dev:server  ] [nodemon] to restart at any time, enter `rs`
[development      ] [run:dev:server  ] [nodemon] watching: ./src/server.jsx /home/tux/workspace/plone-react/src/**/* ./dist/server.js
[development      ] [run:dev:server  ] [nodemon] starting `babel-node ./src/start-server.js`
[development      ] [build:dev:server] 
[development      ] [build:dev:server] Webpack is watching the files…
[development      ] [build:dev:server] 
[development      ] [build:dev:client] events.js:160
[development      ] [build:dev:client]       throw er; // Unhandled 'error' event
[development      ] [build:dev:client]       ^
[development      ] [build:dev:client] 
[development      ] [build:dev:client] Error: listen EADDRINUSE :::4301
[development      ] [build:dev:client]     at Object.exports._errnoException (util.js:1026:11)
[development      ] [build:dev:client]     at exports._exceptionWithHostPort (util.js:1049:20)
[development      ] [build:dev:client]     at Server._listen2 (net.js:1257:14)
[development      ] [build:dev:client]     at listen (net.js:1293:10)
[development      ] [build:dev:client]     at Server.listen (net.js:1389:5)
[development      ] [build:dev:client]     at EventEmitter.listen (/home/tux/workspace/plone-react/node_modules/express/lib/application.js:618:24)
[development      ] [build:dev:client]     at Object.<anonymous> (/home/tux/workspace/plone-react/webpack/server.dev.js:32:5)
[development      ] [build:dev:client]     at Module._compile (module.js:570:32)
[development      ] [build:dev:client]     at loader (/home/tux/workspace/plone-react/node_modules/babel-register/lib/node.js:144:5)
[development      ] [build:dev:client]     at Object.require.extensions.(anonymous function) [as .js] (/home/tux/workspace/plone-react/node_modules/babel-register/lib/node.js:154:7)
[development      ] [build:dev:client]     at Module.load (module.js:487:32)
[development      ] [build:dev:client]     at tryModuleLoad (module.js:446:12)
[development      ] [build:dev:client]     at Function.Module._load (module.js:438:3)
[development      ] [build:dev:client]     at Function.Module.runMain (module.js:604:10)
[development      ] [build:dev:client]     at Object.<anonymous> (/home/tux/workspace/plone-react/node_modules/babel-cli/lib/_babel-node.js:154:22)
[development      ] [build:dev:client]     at Module._compile (module.js:570:32)
[development      ] [build:dev:client] error Command failed with exit code 1.
[development      ] [build:dev:client] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[development      ] [build:dev:server] error Command failed with signal "SIGTERM".
[development      ] [build:dev:server] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[development      ] [run:dev:server  ] error Command failed with signal "SIGTERM".
[development      ] [run:dev:server  ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[development      ] ERROR: "build:dev:client" exited with 1.
[development      ] error Command failed with exit code 1.
[development      ] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "development" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "dev:build" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@tisto
Copy link
Member

tisto commented Jan 16, 2018

@tulikavijay we should remove phantomjs altogether. This dependency is not needed any longer.

@tulikavijay
Copy link

@ajayns have you tried yarn dev? Is it working?

@ajayns
Copy link
Contributor Author

ajayns commented Jan 19, 2018

Using the latest version of the master branch I've installed and I'm running the backend and dev server in accordance to what's specified in the readme. But what I still seem to get is

Something went wrong: Invalid token specified: Cannot read property 'replace' of undefined

On my browser.

On running backend I get this:

2018-01-19 13:43:48 INFO ZServer HTTP server started at Fri Jan 19 13:43:48 2018
	Hostname: 0.0.0.0
	Port: 8080
2018-01-19 13:44:30 WARNING ZODB.blob (4165) Blob dir /media/ajayns/Projects/Code/xPR/plone-react/api/var/blobstorage/ has insecure mode setting
2018-01-19 13:45:33 INFO Plone OpenID system packages not installed, OpenID support not available
2018-01-19 13:45:44 WARNING Init Class plone.app.tiles.browser.add.DefaultAddView has a security declaration for nonexistent method 'browserDefault'
2018-01-19 13:45:44 WARNING Init Class plone.app.tiles.browser.add.DefaultAddView has a security declaration for nonexistent method 'publishTraverse'
2018-01-19 13:45:44 WARNING Init Class plone.app.tiles.browser.edit.DefaultEditView has a security declaration for nonexistent method 'browserDefault'
2018-01-19 13:45:44 WARNING Init Class plone.app.tiles.browser.edit.DefaultEditView has a security declaration for nonexistent method 'publishTraverse'
2018-01-19 13:45:44 WARNING Init Class plone.app.tiles.browser.delete.DefaultDeleteView has a security declaration for nonexistent method 'browserDefault'
2018-01-19 13:45:44 WARNING Init Class plone.app.tiles.browser.delete.DefaultDeleteView has a security declaration for nonexistent method 'publishTraverse'
2018-01-19 13:45:44 WARNING Init Class plone.app.drafts.storage.Storage has a security declaration for nonexistent method 'drafts'
2018-01-19 13:45:46 INFO Zope Ready to handle requests

Running the dev server there's this error:

[development      ] [build:dev:client] ERROR in ./node_modules/css-loader?{"importLoaders":2,"sourceMap":true,"localIdentName":"[name]__[local]___[hash:base64:5]"}!./node_modules/less-loader/dist/cjs.js?{"outputStyle":"expanded","sourceMap":true}!./node_modules/semantic-ui-less/semantic.less

Should I check out your fix? Is it solving this issue? @tulikavijay
Also, any suggestions to fix this? @tisto

@tisto
Copy link
Member

tisto commented Jan 19, 2018 via email

@ajayns
Copy link
Contributor Author

ajayns commented Jan 22, 2018

@tisto Sorry for the late reply.

For setting up I've run

$ yarn

$ cd api
$ python bootstrap-buildout.py
$ ./bin/buildout

And to run the server

$ cd api
$ ./bin/instance fg

// Another terminal window
$ yarn dev

And the output on the browser then seems to be:

Something went wrong: Invalid token specified: Cannot read property 'replace' of undefined

@tisto
Copy link
Member

tisto commented Jan 22, 2018

Which version of npm and yarn are you using?

@ajayns
Copy link
Contributor Author

ajayns commented Jan 22, 2018

npm: 5.6.0
yarn: 0.27.5
@tisto

@tisto
Copy link
Member

tisto commented Jan 22, 2018

@ajayns sorry, I meant which node version are you using. Your yarn version is outdated, please make sure you use the latest one.

@ajayns
Copy link
Contributor Author

ajayns commented Jan 22, 2018

@tisto I'm using node version 8.9. Okay will do updates and try reinstalling from scratch?

@tisto
Copy link
Member

tisto commented Jan 22, 2018

Yes.

@ajayns
Copy link
Contributor Author

ajayns commented Jan 22, 2018

@tisto After updating yarn when I run 'yarn' to install packages, it seems to show my version of node is incompatible and it requires '6.11'. Shouldn't plone-react be updated to support the latest LTS version of Node? Or right now I'll just downgrade my Node locally for it to work?

@tisto
Copy link
Member

tisto commented Jan 23, 2018 via email

@ajayns
Copy link
Contributor Author

ajayns commented Jan 25, 2018

@tisto Okay so, I've got an instance of Plone running with its restapi at localhost:8080. And for the frontend I've switched node to v6.11.4 and installed all packages with yarn.

Running yarn dev still gives this output on the browser:

Something went wrong: Invalid token specified: Cannot read property 'replace' of undefined

I think it's a problem with the frontend installation probably. Any luck installing @tulikavijay ?

@tulikavijay
Copy link

@ajayns For installing frontend i still have to use the workaround for phantomjs. And no, yarn dev does not work for me.
@tisto Can you specify what do you mean by '- copy the buildout configuration to buildout.cfg' ?

@robgietema
Copy link
Member

Fixed by #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants