Error: Cannot find module, despite module installed globally
Error: Cannot find module, despite module installed globally
I am using Intellij Idea and I am trying to run a Node script that uses the Puppeteer module. When I run the script outside of Intellij Idea, it works fine. But when I run it inside, I get the following error:
Error: Cannot find module 'puppeteer'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/myuser/.rvm/gems/ruby-2.1.2@core/bundler/gems/docket-plus-43e0140393ef/lib/data/js/county/practice.js:6:19)
Basically, the script is inside a ruby gem stored somewhere else in filesystem. I run the script from another project. But I set up puppeteer with npm globally:
npm install -g puppeteer
This means that the puppeteer should be found no matter where I run the script. I installed the NodeJS plugin for Intellij Idea and I see puppeteer cited in the preferences:
Yet i continue to get this error. Why can't it find the puppeteer module?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment