barrysteyn / node-scrypt

Scrypt for Node
369 stars 88 forks source link

scrypt invalid ELF header when running npm run build #196

Open parastooveisi opened 5 years ago

parastooveisi commented 5 years ago

I'm working on a project with Next.js and react. In my project Next.js version was 4.2.3 and my application was running properly with "npm run dev" but with "npm run build" I was getting an error because of some modules that do not support ES6. After being unsuccessful in solving the problem I decided to reinstall needed modules again.

The version of next.js is 8.1.0 now. However, after reinstalling modules, I cannot run (npm run dev or node server.js) or build (npm run build) the application because I am getting this error which I have not found any way to solve it:

Build error occurred Error: /home/parastoo/Dropbox/Projects/Ethereum/node_modules/scrypt/build/Release/scrypt.node: invalid ELF header at Object.Module._extensions..node (module.js:681:18) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/parastoo/Dropbox/Projects/Ethereum/node_modules/scrypt/index.js:3:20) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/parastoo/Dropbox/Projects/Ethereum/node_modules/scrypt.js/node.js:1:76) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18)

package.json is:

{
 "name": "supplychain",
 "version": "1.0.0",
 "description": "",
 "main": "routes.js",
 "directories": {
   "test": "test"
 },
"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "dev": "node server.js",
  "start": "node server.js",
  "build": "next build"
},
"author": "",
"license": "ISC",
"dependencies": {
  "fs-extra": "^8.0.1",
  "ganache-cli": "^6.4.4",
  "mocha": "^6.1.4",
  "next": "^8.1.0",
  "next-routes": "^1.4.2",
  "react": "^16.8.6",
  "react-dom": "^16.8.6",
  "scrypt": "^6.0.3",
  "semantic-ui-react": "^0.87.2",
  "solc": "^0.5.9",
  "web3": "^1.0.0-beta.35"
 }
}

Can someone help me solve the problem?

chrisveness commented 5 years ago

This repo is no longer maintained.

If you are using scrypt.hash, it is now available natively in the Node.js crypto module.

If you are using scrypt.kdf / scrypt.verifyKdf, scrypt-kdf is a close-to-direct replacement.