我有一个节点(Ubuntu 16,Laravel 5.2,Php 7,Nginx),我使用默认配方进行配置:
package 'git'
package 'php'
package 'composer'
include_recipe 'nodejs'
include_recipe 'nodejs::npm'
nodejs_npm 'gulp'
...
more commands
...
默认配方工作正常。当我到达我的部署配方时,每次尝试使用nodejs_npm服务从package.json安装时都会失败。
nodejs_npm 'package.json' do
path /path/to/app/dir
json true
user 'ubuntu'
options ['--dependencies', '--silent']
end
我在他们的github页面上跟踪他们的大纲,所以我不确定发生了什么,但这是我收到的消息和编译资源:
================================================================================
Error executing action `install` on resource 'nodejs_npm[package.json]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
execute[install NPM package package.json] (/var/chef/cache/cookbooks/nodejs/providers/npm.rb line 6) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ''
---- Begin output of npm install --dependencies ----
STDOUT:
STDERR: npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
---- End output of npm install --dependencies ----
Ran npm install --dependencies returned
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/my-cookbook/recipes/deploy.rb:51:in `from_file'
nodejs_npm("package.json") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :nodejs_npm
cookbook_name "my-cookbook"
recipe_name "deploy"
path "/path/to/app/dir"
json true
user "ubuntu"
options ["--dependencies", "--silent"]
package "package.json"
end
答案 0 :(得分:0)
代替完整的错误消息,我只是指出poise-javascript有一个特定的资源:npm_install
。您可能还想查看application_javascript,其中包含更多用于部署节点应用程序的内容,这听起来就像您尝试过的那样。
https://github.com/poise/application_examples/blob/master/recipes/todo_express.rb显示了使用这两者部署简单Express应用程序的示例。可能比你现在拥有的更简单。