Hexo: 升级Node.js v6.0.0之后无法编译

Created on 3 May 2016  ·  24Comments  ·  Source: hexojs/hexo

看到一个跟我类似的issue #1924
切换到 v5.8.0 就没有问题。

错误信息:

Error: Module version mismatch. Expected 48, got 47.
    at Error (native)
    at Object.Module._extensions..node (module.js:568:18)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/bunyan/lib/bunyan.js:79:18)
{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/bunyan/lib/bunyan.js:79:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/bunyan/lib/bunyan.js:79:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32) code: 'MODULE_NOT_FOUND' }
Error: Module version mismatch. Expected 48, got 47.
    at Error (native)
    at Object.Module._extensions..node (module.js:568:18)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/bunyan/lib/bunyan.js:79:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
{ Error: Cannot find module './build/default/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/bunyan/lib/bunyan.js:79:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/hexo-log/lib/log.js:3:14)
    at Module._compile (module.js:541:32) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/bunyan/lib/bunyan.js:79:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/liyanfeng/blog/node_modules/hexo-log/lib/log.js:3:14)
    at Module._compile (module.js:541:32) code: 'MODULE_NOT_FOUND' }

Most helpful comment

You have to rebuild modules with native code/dependency after Node upgrade, as indicated by Module version mismatch. Expected 48, got 47.

npm rebuild hexo

Reinstalling works too:

rm -rf node_modules/
npm i --no-optional

All 24 comments

Can confirm same error with NodeJs v6.0.0

hexo: 3.2.0
hexo-cli: 1.0.1
os: Darwin 15.4.0 darwin x64
http_parser: 2.7.0
node: 6.0.0
v8: 5.0.71.35
uv: 1.9.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 48
openssl: 1.0.2g

My hexo version info :

hexo-cli: 1.0.1
os: Darwin 15.4.0 darwin x64
http_parser: 2.7.0
node: 6.0.0
v8: 5.0.71.35
uv: 1.9.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 48
openssl: 1.0.2g

@ludo237

I use node version manage module which named n to back to v5.8.0 and everything is ok.

I suggest that before the hexo fix this issue you can do this

@pod4g I changed back to v5.8.0 but still has this issue:

➜  blog hexo
[Error: Module version mismatch. Expected 47, got 48.]
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

My hexo info:

hexo: 3.2.0
hexo-cli: 1.0.1
os: Darwin 15.4.0 darwin x64
http_parser: 2.6.2
node: 5.8.0
v8: 4.6.85.31
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 47    <-- Is this the problem? How to update this version?
openssl: 1.0.2g

I found 2 workarounds below but neither of them works:

  1. https://hexo.io/docs/troubleshooting.html#Error-with-DTrace-Mac-OS-X
  2. http://kikoroc.com/2016/05/04/resolve-hexo-DTraceProviderBindings-MODULE-NOT-FOUND.html

Hexo do not pass node 6 's tests now.

@fantasymaker-cn you can try this #1274. good luck .

@Xuanwo no problemo. Any ETA on nodev6 support?

@pod4g Oops...no luck. I tried but still got error:

{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

@fantasymaker-cn I haven't met this problem , but I found this problem is very common by search on google .. if you solve this problem finally, please Tell me

I reinstalled hexo-cli

npm uninstall hexo-cli -g
npm install hexo-cli -g

hexo s is missing and hexo g shows:

ERROR Process failed: layout/.DS_Store
TypeError: Cannot read property 'compile' of undefined
hexo: 3.2.0
hexo-cli: 1.0.1
os: Darwin 15.4.0 darwin x64
http_parser: 2.7.0
node: 6.1.0
v8: 5.0.71.35
uv: 1.9.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 48
openssl: 1.0.2h

same errors

ERROR Process failed: layout/.DS_Store
TypeError: Cannot read property 'compile' of undefined

hexo: 3.2.0
hexo-cli: 1.0.1
os: Darwin 15.4.0 darwin x64
http_parser: 2.5.2
node: 4.4.4
v8: 4.5.103.35
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 46
openssl: 1.0.2h

@Artwalk @cielpy you need skip_render the .DS_Store

OK, but how?

Which file can configure to skip it?

On May 10, 2016, at 10:31 AM, 漩涡 [email protected] wrote:

@Artwalk https://github.com/Artwalk @cielpy https://github.com/cielpy you need skip_render the .DS_Store


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub https://github.com/hexojs/hexo/issues/1939#issuecomment-218043734

@Artwalk edit the _config.yml may solve this problem.

skip_render option?this option can skip folder,how to skip files,every subfolder has a .DS_Store file.

I just delete all .DS_Store files recursive,use this command
find ./ -name ".DS_Store" -depth -exec rm {} \; from https://helpx.adobe.com/dreamweaver/kb/remove-ds-store-files-mac.html
Just works temporarily.

change the stable version

".DS_Store" is another known issue #1855 for Hexo 3.2.

I had the original error @pod4g described. I could resolve it by updating xcode dependencies (opened xcode and it prompted to do so), reinstalling hexo-cli and updating node to v6.2.0.

You have to rebuild modules with native code/dependency after Node upgrade, as indicated by Module version mismatch. Expected 48, got 47.

npm rebuild hexo

Reinstalling works too:

rm -rf node_modules/
npm i --no-optional

hexo update?

I solved this by adding sudo permission when installing: $ sudo npm install hexo --no-optional

@leesei Your solution worked for me!

Just reinstall your package from npm:
rm -rf node_modules && npm install
http://blog.jonathanargentiero.com/node-js-error-module-version-mismatch-expected-48-got-46/

I find that I can install it with npm install hexo
But I can not install it with npm install hexo -g
So, I just go to the global catalog(Mine is /root/Cache/NPM/.npm-global/lib/node_modules) and install it with npm install hexo
And then add the bin catalog of hexo to the environment path.
Hope this works for you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hjmJhon picture hjmJhon  ·  3Comments

testareas picture testareas  ·  3Comments

hgDendi picture hgDendi  ·  3Comments

Helihua1992 picture Helihua1992  ·  3Comments

mashirozx picture mashirozx  ·  3Comments