如果用node-gyp 6.4.1 在使用 truffle compile 會發生Cannot find module './build/Release/scrypt'
出現以下錯誤
Error: Cannot find module './build/Release/scrypt'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (C:\Users\a2924\git\iogtoken\node_modules\scrypt\index.js:3:20)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
很好這是新板的node-gyp 6.4.1的BUG
這時候要去修改
[專案位置]/\node_modules\scrypt\index.js
修改以下程式碼
//var scryptNative = require("./build/Release/scrypt")
var scryptNative = require("scrypt")
這樣就可以成功了
Error: Cannot find module './build/Release/scrypt'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
很好這是新板的node-gyp 6.4.1的BUG
這時候要去修改
[專案位置]/\node_modules\scrypt\index.js
修改以下程式碼
//var scryptNative = require("./build/Release/scrypt")
var scryptNative = require("scrypt")
這樣就可以成功了
留言
張貼留言