简体   繁体   中英

npm install via fabric

while trying to run "npm install" with help of fabric on a server with Ubuntu operating system i get an error "npm command not found"

 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")

The python code is trying to install npm with the values avialabe in package.json file

 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.

My aim is to run the command npm install without installing node or npm as root user but with the help of nvm which configures node for particular user rather than root.


Each run command operates independently. If you want to do what you are trying to do use the prefix context manager instead to update PATH .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM