Error Compiling truffle project, stuck with unfound error, - node.js

I am using WSL (ubuntu 18.04) I've installed truffle, solc, and node js (npm)...
I've started a simple project in truffle and then when I compile using truffle compile. I stuck with an error
Compiling your contracts...
===========================
Error: SyntaxError: Unexpected end of input
at Object.compile (/mnt/c/Users/Test/AppData/Roaming/npm/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:72:1)
Truffle v5.1.2 (core: 5.1.2)
Node v13.5.0
I couldn't even locate this index.js file. Where could this be?

Check your contract pragma statement or truffle config.
If you might be compiling against wrong solidity compiler.

Related

Runing npx truffle develop

This version of µWS is not compatible with your Node.js build:
Error: Cannot find module './uws_darwin_x64_108.node'
Falling back to a NodeJS implementation; performance may be degraded.
Could not find suitable configuration file.
Truffle v5.5.6 (core: 5.5.6)
Node v18.2.0
Run npx truffle develop on a command line

Error: Cannot find module 'web3' when trying to use web3.js from Node

internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'web3'
I am getting this error when I am entering command node filename.js in terminal of Visual Studio Code.
and when I run (Ctrl+f5) then Google Chrome opens blank.
Have you installed web3.js?
You can install it by using
npm install web3
if you have done it then please provide the code so i can check it.

Which version works properly with Solidity and Truffle?

The Solidity version 0.5.0 works well with Remix online software.
When you try to use that code in Visual Studio Code it creates an error, and there is not output after truffle compile,truffle migrate.
Truffle version:
Truffle v5.0.7 (core: 5.0.7)
Solidity v0.5.0 (solc-js)
Node v8.15.0

Different compiling version while trying to run an electron project

I currently an trying to make a node js project using electron and node-gyp for c addons. But when I try to run my program using
electron index.js
I get this error:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/ubspy/Code/Node-c-test/build/Release/addons.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 54. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
at process.module.(anonymous function) [as dlopen]
I've tried reinstalling all the packages, and recompiling all the source code, I don't know what's wrong.
I figured it out after many a trial and error, after upgrading electron to the most recent beta version the module versions matched, and the program ran flawlessly.

Running node-serialport in nw.js

I am trying to run node-serialport in nw.js. After following the nw.js documentation concerning native modules, node-serialport seems to build just fine, and runs perfectly in a regular node process.
Unfortunately, I get the following error in the nw.js console window:
{project_dir}\node_modules\serialport\node_modules\bindings\bindings.js:83 Uncaught Error: Module version mismatch. Expected 48, got 46.
How can I run these together? Am I missing something obvious?
Note that I'm currently running:
Windows 7 x64
Node v4.4.4
npm v2.4.1
nw.js v0.15.0
node-gyp v3.3.1
serialport v3.1.2
Apparently I needed to update to the Current version of Node (v6.2.0) instead of the LTS version (v4.4.4). After updating and rebuilding serialport, everything works perfectly!

Resources