我在配置程序中按照以下步骤在新的azure vm上安装nvm但我无法安装。源不加载sh脚本。
{
"variables": {
"client_id": "{{env `ARM_CLIENT_ID`}}",
"client_secret": "{{env `ARM_CLIENT_SECRET`}}",
"resource_group": "{{env `ARM_RESOURCE_GROUP`}}",
"storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}",
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
"ssh_user": "palm",
"ssh_pass": null
},
"builders": [{
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"resource_group_name": "{{user `resource_group`}}",
"storage_account": "{{user `storage_account`}}",
"subscription_id": "{{user `subscription_id`}}",
"capture_container_name": "images",
"capture_name_prefix": "packer",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04-LTS",
"azure_tags": {
"ticket": "palm"
},
"location": "East US",
"vm_size": "Standard_DS2_v2"
}],
"provisioners": [{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [
"curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash",
"source ~/.bashrc",
"nvm install v8.9.4",
"nvm alias default v8.9.4",
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
],
"inline_shebang": "/bin/sh -x",
"type": "shell"
}]
运行构建脚本时出现以下错误。不知道为什么它说没有找到nvm命令。
./packer build -var-file=variable.json ubuntu-16.04-nodejs.json
azure-arm output will be in this color.
==> azure-arm: Running builder ...
azure-arm: Creating Azure Resource Manager (ARM) client ...
==> azure-arm: Creating resource group ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-j5kfs33y6n'
==> azure-arm: -> Location : 'East US'
==> azure-arm: -> Tags :
==> azure-arm: ->> ticket : palm-972
==> azure-arm: Validating deployment template ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-j5kfs33y6n'
==> azure-arm: -> DeploymentName : 'pkrdpj5kfs33y6n'
==> azure-arm: Deploying deployment template ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-j5kfs33y6n'
==> azure-arm: -> DeploymentName : 'pkrdpj5kfs33y6n'
==> azure-arm: Getting the VM's IP address ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-j5kfs33y6n'
==> azure-arm: -> PublicIPAddressName : 'packerPublicIP'
==> azure-arm: -> NicName : 'packerNic'
==> azure-arm: -> Network Connection : 'PublicEndpoint'
==> azure-arm: -> IP Address : '40.71.227.46'
==> azure-arm: Waiting for SSH to become available...
==> azure-arm: Connected to SSH!
==> azure-arm: Provisioning with shell script: /tmp/packer-shell063897685
azure-arm: % Total % Received % Xferd Average Speed Time Time Time Current
azure-arm: Dload Upload Total Spent Left Speed
azure-arm: 100 12540 100 12540 0 0 40290 0 --:--:-- --:--:-- --:--:-- 40321
azure-arm: => Downloading nvm from git to '/home/packer/.nvm'
azure-arm: Cloning into '/home/packer/.nvm'...
azure-arm: Note: checking out '7ad6d98cedde01809e32d56ab8ced064f6f28175'.
azure-arm:
azure-arm: You are in 'detached HEAD' state. You can look around, make experimental
azure-arm: changes and commit them, and you can discard any commits you make in this
azure-arm: state without impacting any branches by performing another checkout.
azure-arm:
azure-arm: If you want to create a new branch to retain commits you create, you may
azure-arm: do so (now or later) by using -b with the checkout command again. Example:
azure-arm:
azure-arm: git checkout -b <new-branch-name>
azure-arm:
azure-arm: => => Compressing and cleaning up git repository
azure-arm:
azure-arm: => Appending nvm source string to /home/packer/.bashrc
azure-arm: => Appending bash_completion source string to /home/packer/.bashrc
azure-arm: => Close and reopen your terminal to start using nvm or run the following to use it now:
azure-arm: /tmp/script_8684.sh: 3: /tmp/script_8684.sh: source: not found
azure-arm:
azure-arm: /tmp/script_8684.sh: 4: /tmp/script_8684.sh: nvm: not found
azure-arm: export NVM_DIR="$HOME/.nvm"
azure-arm: [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
azure-arm: /tmp/script_8684.sh: 5: /tmp/script_8684.sh: nvm: not found
azure-arm: [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
azure-arm: WARNING! The waagent service will be stopped.
azure-arm: WARNING! Cached DHCP leases will be deleted.
azure-arm: WARNING! root password will be disabled. You will not be able to login as root.
azure-arm: WARNING! /etc/resolvconf/resolv.conf.d/tail and /etc/resolvconf/resolv.conf.d/original will be deleted.
azure-arm: WARNING! packer account and entire home directory will be deleted.
==> azure-arm: Querying the machine's properties ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-j5kfs33y6n'
==> azure-arm: -> ComputeName : 'pkrvmj5kfs33y6n'
==> azure-arm: -> OS Disk : 'https://ubuntujava8.blob.core.windows.net/images/pkrosj5kfs33y6n.vhd'
==> azure-arm: Powering off machine ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-j5kfs33y6n'
==> azure-arm: -> ComputeName : 'pkrvmj5kfs33y6n'
如何使用packer动态运行nvm?有没有其他方法可以使用配置文件安装nvm?
答案 0 :(得分:0)
您错过了第一个错误
SELECT
A.id_ord,
A.id_ord,
A.order,
A.codseller,
A.codbuyer,
(SELECT location FROM TABLE2 B WHERE B.id=A.codseller LIMIT 1) sel_loca, -- this should work as just a single result will be returned
(SELECT location FROM TABLE2 B WHERE B.id=A.codbuyer LIMIT 1) buy_loc
FROM TABLE1 A;
@(Html.Kendo().Window().Name("AssetLocator")
.Title("Asset Locator")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(350)
.LoadContentFrom("_LaunchAssetLocator", "Form707B", new { levelid = getsite(); })
)
不是内置的有效内容,您应该使用tmp/script_8684.sh: 3: /tmp/script_8684.sh: source: not found
代替。即。
source
答案 1 :(得分:0)
我遇到了同样的错误。我通过运行解决了这个问题:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
然后使用它。