如何在termux上安装npm

时间:2020-05-21 20:42:00

标签: npm-install

我正在尝试使用android termux上的npm install命令安装npm,但出现错误,有没有办法解决此问题

如果有办法请帮助

4 个答案:

答案 0 :(得分:1)

我想您可能会更详细地说明所遇到的错误。无论如何,我认为您可以使用pkg install nodejs在termux上安装nodejs软件包,这将在设备上安装 node npm 。然后使用npm -v检查版本。

答案 1 :(得分:0)

安装

确保首先从 Play商店在Android设备上安装了 termux-api

然后使用apt install termux-api 安装脚本。

最后获得此节点模块:

$ npm install --save termux

Example usage
const api = require('termux')

if (!api.hasTermux) process.exit(1)

api.vibrate()
   .duration(1000)
   .run()

api.clipboardGet()
   .run()
   .then(function (text) {
     // ...
   })

这是我的看法,如果您仍然遇到任何问题,请随时询问。

答案 2 :(得分:0)

重要的是:从商店安装 termux 后,打开控制台,并将其更新/升级到最新版本。以下列表中的检查是可跳过的。

// system update, there could be changes to the state of store version
apt-get update && apt-get upgrade

//check linux version ( 2021.01.19. current:  apt/stable 2.1.15, Linux 4.4.23+)
termux-info

// Access Android and Chrome hardware features.
apt install termux-api

// install nodejs
apt install nodejs

//check npm version ( 2021.01.19. current:  6.14.10)
npm -v

// check node version (current: v14.15.4)
node -v

答案 3 :(得分:0)

很简单:- 安装termux后打开应用程序并运行命令

apt update 
apt upgrade

然后简单地写

pkg install nodejs-lts 

或者 写

npm

写完 npm termux 会提示“npm package is not installed , install by execution //code 你完成了这里有两个选项..?????? 希望能帮到你??

相关问题