1、错误描述
[编译scss/sass] 14:56:38.373 internal/modules/cjs/loader.js:717
[编译scss/sass] 14:56:38.373 return process.dlopen(module, path.toNamespacedPath(filename));
[编译scss/sass] 14:56:38.373 ^
[编译scss/sass] 14:56:38.373 Error: Module did not self-register.
[编译scss/sass] 14:56:38.373 at Object.Module._extensions..node (internal/modules/cjs/loader.js:717:18)
[编译scss/sass] 14:56:38.373 at Module.load (internal/modules/cjs/loader.js:598:32)
[编译scss/sass] 14:56:38.373 at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
[编译scss/sass] 14:56:38.373 at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[编译scss/sass] 14:56:38.373 at Module.require (internal/modules/cjs/loader.js:636:17)
[编译scss/sass] 14:56:38.373 at require (internal/modules/cjs/helpers.js:20:18)
[编译scss/sass] 14:56:38.373 at module.exports (G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-chinalibinding.js:19:10)
[编译scss/sass] 14:56:38.373 at Object.<anonymous> (G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-chinalibindex.js:14:35)
[编译scss/sass] 14:56:38.373 at Module._compile (internal/modules/cjs/loader.js:688:30)
[编译scss/sass] 14:56:38.373 at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
2、错误原因
错误提示是模块没有注册,使用npm Install安装,结果还是报错,说明模块没有安装成功
G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-chinavendorwin32
-x64-64>npm install
> node-sass-china@4.7.2 install G:HBuilderXpluginscompile-node-sass
ode_modu
les
ode-sass-china
> node scripts/install.js
node-sass build Binary found at G:HBuilderXpluginscompile-node-sass
ode_modu
les
ode-sass-chinavendorwin32-x64-64inding.node
> node-sass-china@4.7.2 postinstall G:HBuilderXpluginscompile-node-sass
ode_
modules
ode-sass-china
> node scripts/build.js
Binary found at G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-ch
inavendorwin32-x64-64inding.node
Testing binary
Binary has a problem: Error: \?G:HBuilderXpluginscompile-node-sass
ode_mod
ules
ode-sass-chinavendorwin32-x64-64inding.node is not a valid Win32 appli
cation.
\?G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-chinavendorw
in32-x64-64inding.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:717:18)
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)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at module.exports (G:HBuilderXpluginscompile-node-sass
ode_modules
ode-
sass-chinalibinding.js:19:10)
at Object.<anonymous> (G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-chinalibindex.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
Building the binary locally
Building: F:
odejs
ode.exe G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-china
ode_modules
ode-gypin
ode-gyp.js rebuild --verbose --libsa
ss_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'F:\nodejs\node.exe',
gyp verb cli 'G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sa
ss-china\node_modules\node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.13.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (G:HBuilderXpluginscompile-no
de-sass
ode_modules
ode-sass-china
ode_moduleswhichwhich.js:13:12)
gyp verb `which` failed at F (G:HBuilderXpluginscompile-node-sass
ode_mo
dules
ode-sass-china
ode_moduleswhichwhich.js:68:19)
gyp verb `which` failed at E (G:HBuilderXpluginscompile-node-sass
ode_mo
dules
ode-sass-china
ode_moduleswhichwhich.js:80:29)
gyp verb `which` failed at G:HBuilderXpluginscompile-node-sass
ode_modul
es
ode-sass-china
ode_moduleswhichwhich.js:89:16
gyp verb `which` failed at G:HBuilderXpluginscompile-node-sass
ode_modul
es
ode-sass-china
ode_modulesisexeindex.js:42:5
gyp verb `which` failed at G:HBuilderXpluginscompile-node-sass
ode_modul
es
ode-sass-china
ode_modulesisexewindows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (G:HBuilderXpluginscompile-no
de-sass
ode_modules
ode-sass-china
ode_moduleswhichwhich.js:13:12)
gyp verb `which` failed at F (G:HBuilderXpluginscompile-node-sass
ode_mo
dules
ode-sass-china
ode_moduleswhichwhich.js:68:19)
gyp verb `which` failed at E (G:HBuilderXpluginscompile-node-sass
ode_mo
dules
ode-sass-china
ode_moduleswhichwhich.js:80:29)
gyp verb `which` failed at G:HBuilderXpluginscompile-node-sass
ode_modul
es
ode-sass-china
ode_moduleswhichwhich.js:89:16
gyp verb `which` failed at G:HBuilderXpluginscompile-node-sass
ode_modul
es
ode-sass-china
ode_modulesisexeindex.js:42:5
gyp verb `which` failed at G:HBuilderXpluginscompile-node-sass
ode_modul
es
ode-sass-china
ode_modulesisexewindows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python2
at getNotFoundError (
G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\node_m
odules\which\which.js:13:12)
at F (G:\HBuilderX\plugins\compile-node-s
ass\node_modules\node-sass-china\node_modules\which\which.js:68:19)
at
E (G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\no
de_modules\which\which.js:80:29)
at G:\HBuilderX\plugins\compile-node-
sass\node_modules\node-sass-china\node_modules\which\which.js:89:16
at
G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\node_
modules\isexe\index.js:42:5
at G:\HBuilderX\plugins\compile-node-sass
ode_modules\node-sass-china\node_modules\isexe\windows.js:36:5
at FSR
eqWrap.oncomplete (fs.js:154:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python E:PythonPython36python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: E:PythonPython36python.EXE -c import sy
s; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:381:11)
gyp ERR! stack at Socket.emit (events.js:182:13)
gyp ERR! stack at Pipe._handle.close (net.js:606:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "F:\nodejs\node.exe" "G:\HBuilderX\plugins\compile-node-sa
ss\node_modules\node-sass-china\node_modules\node-gyp\bin\node-gyp.js" "re
build" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--
libsass_library="
gyp ERR! cwd G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-china
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass-china@4.7.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass-china@4.7.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! F:
odejs
ode_cache\_logs2019-01-10T07_40_54_700Z-debug.log
G:HBuilderXpluginscompile-node-sass
ode_modules
ode-sass-chinavendorwin32
-x64-64>
3、解决办法
将Sass相关的模块卸载后重装
C:UsersAdministrator.USER-0GUONPPBHK>npm uninstall node-sass -D
npm WARN Administrator.USER-0GUONPPBHK No repository field.
npm WARN Administrator.USER-0GUONPPBHK No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modulesfse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
added 33 packages from 16 contributors, removed 22 packages and updated 340 pack
ages in 26.067s
C:UsersAdministrator.USER-0GUONPPBHK>npm install node-sass -D
> node-sass@4.11.0 install C:UsersAdministrator.USER-0GUONPPBHK
ode_modules
ode-sass
> node scripts/install.js
Cached binary found at F:
odejs
ode_cache
ode-sass4.11.0win32-x64-64_bindin
g.node
> node-sass@4.11.0 postinstall C:UsersAdministrator.USER-0GUONPPBHK
ode_modul
es
ode-sass
> node scripts/build.js
Binary found at C:UsersAdministrator.USER-0GUONPPBHK
ode_modules
ode-sassve
ndorwin32-x64-64inding.node
Testing binary
Binary is fine
npm WARN element-ui@2.4.3 requires a peer of vue@^2.5.2 but none is installed. Y
ou must install peer dependencies yourself.
npm WARN muse-ui@3.0.0-rc.7 requires a peer of vue@^2.5.0 but none is installed.
You must install peer dependencies yourself.
npm WARN Administrator.USER-0GUONPPBHK No repository field.
npm WARN Administrator.USER-0GUONPPBHK No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modulesfse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
+ node-sass@4.11.0
added 110 packages from 118 contributors in 26.774s
C:UsersAdministrator.USER-0GUONPPBHK>