Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Java script error occured in Ubuntu 16.04 LTS. #1

Open
TomokoY opened this issue Feb 23, 2017 · 14 comments
Open

Java script error occured in Ubuntu 16.04 LTS. #1

TomokoY opened this issue Feb 23, 2017 · 14 comments

Comments

@TomokoY
Copy link

TomokoY commented Feb 23, 2017

Hello.
I tryed to run iroha-demo-javascript on Ubuntu 16.04 LTS, but I can't.
1)npm install
2)npm run dev
--->Firebox startup and display white page.
Java Script error occured.

SyntaxError: import declarations may only appear at top level of a module  app.js:3
	<anonymous> http://localhost:8080/app.js:618:2
	__webpack_require__ http://localhost:8080/app.js:556:12
	hotCreateRequire/fn http://localhost:8080/app.js:87:20
	<anonymous> http://localhost:8080/app.js:587:19
	__webpack_require__ http://localhost:8080/app.js:556:12
	<anonymous> http://localhost:8080/app.js:579:18
	<anonymous> http://localhost:8080/app.js:1:11

Please tell me, What is wrong.

@TomokoY TomokoY changed the title ava script error occured Java script error occured in Ubuntu 16.04 LTS. Feb 23, 2017
@yves-pkstd
Copy link

Hi, is it possible that you haven't created an .eslintrc and .babelrc file yet in the root folder of the project?

I ran into similar problems because these two files are missing from the repository.

.babelrc

{
  "presets": ["es2015", "stage-2"],
  "plugins": ["transform-runtime"],
  "comments": false
}

.eslintrc.js

module.exports = {
  root: true,
  parserOptions: {
    sourceType: 'module'
  },
  // required to lint *.vue files
  plugins: [
    'html',
    'standard',
    'promise'
  ],
  // add your custom rules here
  'rules': {
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

@takemiyamakoto
Copy link
Contributor

Does it work if those two files are added?

@TomokoY
Copy link
Author

TomokoY commented Feb 27, 2017

Thank you.
I added two files.
But I can't see iroha-demo on firefox.
1)npm run dev
--->Firefox start and display message.
"Cannot GET / "
New Error eccored in console.

ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/CreateUser.vue
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../src/iroha.js in /home/tomoko/work_iroha/iroha-demo-javascript-master/src/components
 @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/CreateUser.vue 7:13-45

ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/Send.vue
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../src/iroha.js in /home/tomoko/work_iroha/iroha-demo-javascript-master/src/components
 @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/Send.vue 7:13-45

I have not src/iroha.js. Please tell me Where it is.

@yves-pkstd
Copy link

yves-pkstd commented Feb 27, 2017

You can get the iroha.js file from the following repository https://github.com/hyperledger/iroha-javascript

Currently the path to the iroha.js file is still hardcoded to ../../../src/iroha.js. For the time being just change the path to the file. I guess the iroha-javascript repository will soon turn into a downloadable npm package.

@TomokoY
Copy link
Author

TomokoY commented Feb 28, 2017

Thank you for reply.

  1. I download iroha.js and set to ../../../src/iroha.js

  2. npm run dev
    --->New error occured in console.

ERROR in ../src/iroha.js
Module not found: Error: Cannot resolve module 'supercop.js' in /home/tomoko/work_iroha/src
 @ ../src/iroha.js 20:23-45
Child html-webpack-plugin for "index.html":
  1. I find supercop.js from following repository
    https://github.com/hyperledger/iroha-javascript/tree/master/test/lib.
    So I copied supercop.js to node_modules folder in my project.

  2. npm run dev
    --->Firefox start and display red flower image window.
    I think it is Iroha top window.
    The window has "username" text box and "createuser" button.
    I input myname in "username" text box and push "createuser" button.
    --->Java script error Occured.
    Please tell me , my step 3 is wrong?

TypeError: supercop.createSeed is not a function[Learn More]  app.js%20line%201560%20%3E%20eval:30:20
	iroha.createKeyPair http://localhost:8080/app.js%20line%201560%20%3E%20eval:30:20
	registAccount http://localhost:8080/app.js%20line%201704%20%3E%20eval:43:18
	boundFn http://localhost:8080/app.js%20line%20624%20%3E%20eval:127:9
	clickCreateUser http://localhost:8080/app.js%20line%201704%20%3E%20eval:38:7
	boundFn http://localhost:8080/app.js%20line%20624%20%3E%20eval:127:9
	module.exports.render/<.on.click http://localhost:8080/app.js%20line%202058%20%3E%20eval:42:9
	createEventHandle/handle.invoker http://localhost:8080/app.js%20line%20624%20%3E%20eval:1944:9

@yves-pkstd
Copy link

That is strange. Supercop is an npm package and is defined as a dependency in the package.json file.

 "dependencies": {
    "supercop": "https://github.com/GUCCI-swallow/supercop.js.git",
  },

It should be available in your node_modules folder after running npm update or npm install.

@TomokoY
Copy link
Author

TomokoY commented Feb 28, 2017

Thank you.

  1. I remove node_modules folder and install again.
  2. I check npm package
├── sinon-chai@2.8.0
├── UNMET DEPENDENCY supercop@git+https://github.com/GUCCI-swallow/supercop.js.git
├─┬ url-loader@0.5.8
│
  1. I update npm
    --->Supercop is Installed.
    Thank you.

@TomokoY
Copy link
Author

TomokoY commented Mar 1, 2017

Hello.

Where can I setup system network.
Java script error Occured.

Error: Network Error
Stack trace:
createError@http://localhost:8080/app.js line 816 > eval:15:15
handleError@http://localhost:8080/app.js line 798 > eval:87:14

@yves-pkstd
Copy link

Hi,

The IROHA_URL is set at https://github.com/soramitsu/iroha-demo-javascript/blob/master/build/webpack.dev.conf.js#L22

However, currently due to this problem hyperledger/iroha#181 it is possible that you will not be able to access the API. Depending on what browser you are using.

If you are getting 405 errors then I suggest trying to test, for the time being, the code in Google Chrome with the following extention installed: allow cors

@TomokoY
Copy link
Author

TomokoY commented Mar 2, 2017

Hello.
1)
I set IROHA_URL in webpack.dev.conf.js
2)
I installed "allow cors" plug-in to Google Chrome.
But I got 405 error whether I set "Enable corss-origin resource sharing Button" to ON or OFF.
3)
Next,
I startup Google Chrome with web-secrurity off mode.
chrome --disable-web-security --user-data-dir

I input username and push Createuser button on Top page.
The page changed to "http://localhost:8080/#/user/wallet".
But new error occured.

GET http://10.0.168.2:1204/api/v1/account?uuid=311636201f8266e984cb5653c7ecb3f6c3f504851a89d47a3575527b3b09780e 404 (Not found)
dispatchXhrRequest @ xhr.js?14ed:175
xhrAdapter @ xhr.js?14ed:12
dispatchRequest @ dispatchRequest.js?91bc:52
User.vue?a314:88 Error: Request failed with status code 404
    at createError (eval at <anonymous> (app.js:816), <anonymous>:15:15)
    at settle (eval at <anonymous> (app.js:1704), <anonymous>:18:12)
    at XMLHttpRequest.handleLoad (eval at <anonymous> (app.js:798), <anonymous>:77:7)

My step 3 is wrong?

@yves-pkstd
Copy link

I will take a look at this. Maybe an API mismatch problem.

@TomokoY
Copy link
Author

TomokoY commented Mar 3, 2017

Thank you very much for your help.
Please tell me which project is match in Client and Server in GitHub.
I want to just start up iroha system without change code .

@yves-pkstd
Copy link

yves-pkstd commented Mar 3, 2017

Next week I will try to work on a working demo application. Currently there seem to be a lot of issues due to API changes etc

As far as your error is concerned, the cause is the API address that is being used in the demo application. All paths are defined as /api/v1/account but the REST API in the iroha master and develop branch is defined as /account ...

So when you replace all /api/v1 occurences in the code with EMPTY then you will get past your error. However after passing that step more problems arise.

I suggest to be patient a bit and wait until a new version of the demo application is available or take a look in https://github.com/hyperledger/iroha/blob/develop/core/infra/server/http_server_with_cappuccino.cpp and match the api addresses yourself for the time being.

@TomokoY
Copy link
Author

TomokoY commented Mar 7, 2017

Thank you for your help.
I'll wait for a new version client.

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

No branches or pull requests

3 participants