我已经在Windows 10上安装了Linux子系统(WSL)和Ubuntu 16.04,然后按照this安装yarn:
sudo apt update
sudo apt install curl
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
它没有引发任何错误。但是,yarn --version
返回了
$ yarn --version
/mnt/c/Users/chengtie/AppData/Roaming/npm/yarn: 12: /mnt/c/Users/chengtie/AppData/Roaming/npm/yarn: node: not found
npm --version
返回了
$ npm --version
: not foundram Files/nodejs/npm: 3: /mnt/c/Program Files/nodejs/npm:
: not foundram Files/nodejs/npm: 5: /mnt/c/Program Files/nodejs/npm:
/mnt/c/Program Files/nodejs/npm: 6: /mnt/c/Program Files/nodejs/npm: Syntax error: word unexpected (expecting "in")
有人知道如何解决此问题吗?
答案 0 :(得分:1)
您必须先安装nodejs
#:kivy 1.11.1
ScreenManager:
MainScreen:
GameScreen:
<MainScreen>:
FloatLayout:
MDRectangleFlatButton:
text: "Start!"
on_touch_down: root.manager.current = "game"
pos_hint: {"center_x" : 0.5, "center_y" : 0.5}
size_hint: None, None
size: 300, 100
<GameScreen>
on_enter: self.play()
<PingPongBall>:
size: 75, 75
canvas:
Ellipse:
pos: self.pos
size: self.size
<PingPongPaddle>:
size: 50, 300
canvas:
Rectangle:
pos:self.pos
size:self.size
<PingPongGame>:
ball: PingPong_ball
player1: player_left
player2: player_right
canvas:
Rectangle:
pos: self.center_x - 5, 0
size: 20, self.height
Label:
font_size: 140
center_x: root.width / 4
top: root.top - 50
text: str(root.player1.score)
Label:
font_size: 140
center_x: root.width * 3 / 4
top: root.top - 50
text: str(root.player2.score)
Label:
font_size: 35
center_x: root.width * 6/7
top: root.top - 650
text: "by me"
PingPongBall:
id: PingPong_ball
center: self.parent.center
PingPongPaddle:
id: player_left
x: root.x
center_y: root.center_y
PingPongPaddle:
id: player_right
x: root.width - self.width
center_y: root.center_y
答案 1 :(得分:0)
看看这个:
/mnt/c/Users/chengtie/AppData/Roaming/npm/yarn: 12
它正在寻找Windows上安装的纱线。您必须从Windows卸载纱线,或将其从WSL的PATH中删除。
使用以下命令从PATH中删除Windows纱线:
WIN_YARN_PATH="\$(dirname "\$(which yarn)")"
export PATH=\$(echo "\${PATH}" | sed -e "s#\${WIN_YARN_PATH}##")
您可以将其添加到您的.bashrc
另外,请查看您的错误消息,它也从Windows获取npm,您需要使用相同的技术将其从路径中删除。
此致
卡洛斯