node-sass安装包错character maps to
问题描述
一个项目,安装拉到本地后npm install,在安装node-sass的时候提示
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Traceback (most recent call last):
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
return gyp_main(args)
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2004, in GenerateOutput
generator_flags))
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 943, in _GenerateProject
return _GenerateMSVSProject(project, options, version, generator_flags)
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1047, in _GenerateMSVSProject
p.WriteIfChanged()
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\MSVSProject.py", line 208, in WriteIfChanged
encoding="Windows-1252")
File "F:\testr\sunday-fast-ui\node_modules\node-gyp\gyp\pylib\gyp\easy_xml.py", line 122, in WriteXmlIfChanged
xml_string = xml_string.decode(default_encoding).encode(encoding)
File "C:\Python27\lib\encodings\cp1252.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 509-511: character maps to <undefined>
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (F:\testr\sunday-fast-ui\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "D:\\nodejs\\node.exe" "F:\\testr\\sunday-fast-ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd F:\testr\sunday-fast-ui\node_modules\node-sass
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2020-05-28T13_13_37_456Z-debug.log
问题出现的环境背景及自己尝试过哪些方法
百度了
UnicodeEncodeError: 'charmap' codec can't encode characters in position 509-511: character maps to <undefined>
说是python编码问题,但是不知道该怎么解决...
你期待的结果是什么?实际看到的错误信息又是什么?
能正常安装
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经解决了,是自己的node-sass和nodejs版本不对应。本地nodejs是12.14.1,项目node-sass版本是4.9.0,改成4.12.0,然后删除掉node_modules目录重新安装就行了,或者
npm cache clean --force
后再安装。node-sass和nodejs版本对应关系查看