npm ERR! UnicodeDecodeError: 'utf8' codec can't decode byte 0xd0

2021-10-16  乐帮网

webpack nodejs

前后端分享项目遇到以下错误:

PS E:\code\svn\行驶记录仪验证装置软件及系统平台\平台端源码文件夹\trunk\TachographsApp> npm install --save node-sass
npm WARN deprecated fsevents@1.2.7: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path E:\code\svn\行驶记录仪验证装置软件及系统平台\平台端源码文件夹\trunk\TachographsApp\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.11.1 | win32 | x64
npm ERR! gyp info find Python using Python version 2.7.18 found at "D:\Install\Python27\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.31727.386) found at:
npm ERR! gyp info find VS "D:\Install\Microsoft Visual Studio\2019\Enterprise"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:19828) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn D:\Install\Python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-sass\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\16.11.1\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\16.11.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.11.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-sass',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-sass\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\gyp_main.py", line 51, in <module>
npm ERR!     sys.exit(gyp.script_main())
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 670, in script_main
npm ERR!     return main(sys.argv[1:])
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 662, in main
npm ERR!     return gyp_main(args)
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 647, in gyp_main
npm ERR!     generator.GenerateOutput(flat_list, targets, data, params)
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2132, in GenerateOutput
npm ERR!     target_list, target_dicts, options, msvs_version
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1936, in _CreateProjectObjects
npm ERR!     guid = _GetGuidOfProject(proj_path, spec)
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 985, in _GetGuidOfProject
npm ERR!     guid = guid or MSVSNew.MakeGuid(proj_path)
npm ERR!   File "E:\code\svn\��ʻ��¼����֤װ��������ϵͳƽ̨\ƽ̨��Դ���ļ���\trunk\TachographsApp\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 51, in MakeGuid
npm ERR!     d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper()
npm ERR! UnicodeDecodeError: 'utf8' codec can't decode byte 0xd0 in position 20: invalid continuation byte
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (E:\code\svn\行驶记录仪验证装置软件及系统平台\平台端源码文件夹\trunk\TachographsApp\node_modules\node-gyp\lib\configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "D:\\Install\\nodejs\\node.exe" "E:\\code\\svn\\行驶记录仪验证装置软件及系统平台\\平台端源码文件夹\\trunk\\TachographsApp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\code\svn\行驶记录仪验证装置软件及系统平台\平台端源码文件夹\trunk\TachographsApp\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.11.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-10-15T10_35_21_918Z-debug.log

划重点,这个最重要的是这两行

npm ERR!     d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper()
npm ERR! UnicodeDecodeError: 'utf8' codec can't decode byte 0xd0 in position 20: invalid continuation byte

具体错误具体分析,一看这个错误就知道是因为编码问题引起的。网上搜索的一般都是更改phyon的默认编码值。在这里是无效的。

真正的错误已经包含在错误提示里了。可以清楚看到报错的路径里有乱码,没有错是用了中文路径。你必须换一个全英文的路径。

好了出了这一个坑又入另一个坑。

 

 

 

 

 

 

公众号二维码

关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com

庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。

欧阳修

付款二维码

如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力