You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added npm to the dev dependencies inside your project, and everything ran fine. Not sure why that is if you didn't encounter the same issue. Again, I have npm installed globally, so it seems like a strange error.
Are you able to post the Lambda function you were trying to run? That way I can test it and see if I get the issue myself. You could probably strip out any sensitive code so long as it still gives you that error.
@Tim-B really sorry to leave this hanging. it's sort of a crazy outlier problem since i have npm installed globally. the lambda function is here: https://github.com/adventrtv/adventr-lambda-video/blob/master/src/video-events.js. again, when i manually add npm to the dev dependencies it runs fine, so i am really not sure what the issue is, but i have it circumvented on my end, so please feel free to close this issue if it's not something you want to worry about.
alternatively, it might be worth adding npm as a dependency in package.json just to avoid the matter if anyone else has the same problem, but it's probably not worth spending too much time hunting.
Would you mind putting the following in a file like test.js outside your project folder then run node test.js:
var npm = require("npm");
console.log(npm);
Do you get Cannot find module 'npm' when running that? For me I get a print out of the object but I suspect the npm module might not be installed globally for everyone.
FYI the packaging tests pass on travis without explicitly including the npm module in devDependencies but npm can be a bit finicky about include paths.
I'm thinking I might either be able to add npm explicitly to the grunt-aws-lambda dependencies to ensure it's included for everyone, or add a warning if the module can't be found so people know to add it to their devDependencies.
Activity
Tim-B commentedon Dec 19, 2014
Are you able to post the Lambda function you were trying to run? That way I can test it and see if I get the issue myself. You could probably strip out any sensitive code so long as it still gives you that error.
adamrneary commentedon Dec 23, 2014
@Tim-B really sorry to leave this hanging. it's sort of a crazy outlier problem since i have npm installed globally. the lambda function is here: https://github.com/adventrtv/adventr-lambda-video/blob/master/src/video-events.js. again, when i manually add npm to the dev dependencies it runs fine, so i am really not sure what the issue is, but i have it circumvented on my end, so please feel free to close this issue if it's not something you want to worry about.
alternatively, it might be worth adding npm as a dependency in package.json just to avoid the matter if anyone else has the same problem, but it's probably not worth spending too much time hunting.
thanks again for posting the code. very useful.
taphat commentedon Jan 16, 2015
We also had to add npm to dev dependencies to get it to work. Same reason, we had npm installed globally. Thanks for posting this issue
Tim-B commentedon Jan 17, 2015
Hi @adamrneary and @taphat, sorry for the delay in following this up.
Would you mind putting the following in a file like test.js outside your project folder then run
node test.js:Do you get
Cannot find module 'npm'when running that? For me I get a print out of the object but I suspect the npm module might not be installed globally for everyone.FYI the packaging tests pass on travis without explicitly including the npm module in devDependencies but npm can be a bit finicky about include paths.
I'm thinking I might either be able to add npm explicitly to the grunt-aws-lambda dependencies to ensure it's included for everyone, or add a warning if the module can't be found so people know to add it to their devDependencies.
gurre commentedon Apr 5, 2015
I got this error too. Tried
console.log(npm);and got:sudo npm install npm --save-devseems to be a quick fix.levbrie commentedon May 23, 2015
+1 (I also had to add npm to dev deps)