我正在尝试建立一个反应项目。但是,当我运行 npm install 时,它会抛出此错误:
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for inotify@1.4.6: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm ERR! notsup Valid OS: linux
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: darwin
npm ERR! notsup Actual Arch: x64
Run Code Online (Sandbox Code Playgroud)
显然,我的 Mac 似乎不支持这个库。我希望一些解决方法可以解决这个问题,而不是删除这个库。请建议我如何解决这个问题。
必须编写一些代码来定义一个可以使用两个或三个参数的函数。
该函数应采用三个参数:
如果温度低于冰点(如果 is_celsius 为 False,则为 32,如果 is_celsius 为 True,则该函数应返回 True)或天气“下雪”。否则,它应该返回 False。
但是请注意, is_celsius 应该是一个可选参数。如果函数调用没有为 is_celsius 提供值,则假定它为 True。
我写了这个
def snowed_in(temperature, weather, **cels):
if weather =="snowy":
return True
elif weather=="sunny":
if 'is_celsius = False' in cels:
if temperature<32:
return True
elif 'is_celsius = True' in cels:
if temperature<0:
print ('ad')
return True
elif 'is_celsius = True' not in cels:
if temperature<0:
return True
else:
return False
Run Code Online (Sandbox Code Playgroud)
以及以下电话
print(snowed_in(15, "sunny")) #Should print False
print(snowed_in(15, "sunny",is_celsius = False)) #Should …Run Code Online (Sandbox Code Playgroud)