通过结构进行npm安装

问题描述 投票:1回答:1

[尝试在具有以下结构的服务器上借助光纤网络运行“ npm install”Ubuntu操作系统我收到错误“找不到npm命令”

I have installed node version v6.11.0 and npm version 3.10.10 on the server
>  user@ip-xx-xx-xx-xx:~$ npm -v
   > 3.10.10

> user@ip-xx-xx-xx-xx:~$ node -v
  > v6.11.0

system information
cloud provider: aws
OS: 16.04 LTS
---------------------------------------------------------------------------
i have configured fabric on my local machine

Fabric versoin

> > user-system@xx-xxx-xxx-xx:fab --version
  > Fabric 1.14.0
  > Paramiko 2.4.0



 deploy():
   require('stage', provided_by=(staging,))
   if env.stage in ['staging']:
      with cd(env.app_dir):
         run(". ~/.nvm/nvm.sh")
         run("export PATH=/home/user/.nvm/versions/node/v6.11.0/bin/node:$PATH")
         run("export PATH=/home/user/.nvm/versions/node/v6.11.0/bin/npm:$PATH")
         run("/home/user/.nvm/versions/node/v6.11.0/bin/npm install")

Python代码正在尝试在package.json文件中使用值为avialabe的值安装npm

While executing the Fab script

user@ip-XX_XX_XX_XX:# fab staging:'password' deploy

[server@ip] Executing task 'deploy'

[server@ip] run: . ~/.nvm/nvm.sh
[server@ip] run: export PATH=/home/user/.nvm/versions/node/v6.11.0/bin/node:$PATH
[server@ip] run: export PATH=/home/user/.nvm/versions/node/v6.11.0/bin/npm:$PATH
[server@ip] run: /home/user/.nvm/versions/node/v6.11.0/bin/npm install
[server@ip] out: /usr/bin/env: node: No such file or directory
[server@ip] out: 
Fatal error: run() received nonzero return code 127 while executing!

Requested: /home/user/.nvm/versions/node/v6.11.0/bin/npm install
Aborting.

我的目标是运行命令npm install而不以root用户身份安装节点或npm,而是借助nvm的帮助,该nvm为特定用户而非root配置节点。


[尝试在具有Ubuntu操作系统的服务器上通过结构运行“ npm install”时出现错误“找不到npm命令”,我已经安装了节点版本v6.11.0和npm版本3.10.10 ...

python node.js npm npm-install fabric
1个回答
0
投票

每个run命令独立运行。如果要执行尝试执行的操作,请使用prefix上下文管理器来更新PATH

© www.soinside.com 2019 - 2024. All rights reserved.