Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm having a problem running npm install when using Puppet to set up my application.

I'm using Puppet to set up a node.js application that we will be using live in a few weeks. This application has sqlite3 as a dependency. The problem I run into is when running 'npm install" the sqlite3 dependency has to be compiled from source to run properly. However the correct command:

npm install --build-from-source=sqlite3

Will not run properly using the exec command in Puppet. I have my Puppet code below:

exec { 'npm install --build-from-source=sqlite3' :
    cwd => '/var/video_server',
    user => 'root',
    path => '/usr/local/node/node-default/bin'
}

How do I get either the sqlite3 to properly compile using Puppet? I do not want to have to run npm install manually on every server I set this application up on.

share|improve this question

1 Answer 1

It seems your PATH is not sufficiently configured.
When you build an module from source npm will have to run multiple commands which have to be on your PATH.
So please try this:

exec { 'npm install --build-from-source=sqlite3' :
    cwd => '/var/video_server',
    user => 'root',
    path => ['/usr/local/node/node-default/bin', '/bin', '/usr/bin']
}

hope this helps you out.

To verify yourself it works you could try running as root in /var/video_server :

PATH=/usr/local/node/node-default/bin:/bin:/usr/bin npm install --build-from-source=sqlite3
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.