Please save my sanity with this.
OS: Windows Server 2012 R2
Installed Nodejs via executable. This also installed npm
Tested both via cmd with npm -v and node -v. Both found.
Using cmd installed puppeteer using npm install puppeteer@9.0.0 -g
Windows environment variables added too User variables for Administrator, no spaces:
Variable:NODE_PATH
Value:C:\Users\Administrator\AppData\Roaming\npm\node_modules
Variable:Path Value:C:\Users\Administrator\AppData\Roaming\npm
System variables:
Variable: NODE_PATH
Value:C:\Users\Administrator\AppData\Roaming\npm\node_modules
Variable: Path
Value:C:\Users\Administrator\AppData\Roaming\npm;C:\Program Files (x86)\nodejs\
Got a test file that I run via cmd like this:
node c:/home/pm/wwwroot/test_files/puppeteer/connect-and-check.js
First line within the file:
const puppeteer = require('puppeteer');
All is working fine. So CMD related installation is good
Try the same thing via cfexecute
and it fails on the first line as the module is not found. Full error:
Error: Cannot find module 'puppeteer' Require stack: - C:\home\pm\wwwroot\admin\jscripts\puppeteer\ocprocess.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Function.Module._load (node:internal/modules/cjs/loader:773:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object. (C:\home\pm\wwwroot\admin\jscripts\puppeteer\ocprocess.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10) at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
{ code: 'MODULE_NOT_FOUND',
requireStack: ['C:\home\pm\wwwroot\admin\jscripts\puppeteer\ocprocess.js' ] }
Any thoughts? The puppeteer module is installed globally (also tried with --save
, but made no difference), works via command line, but fails via app itself. Worst thing, we got the same setup on another VPS, literally the same versions, environment variables etc. and it is working fine. What am I missing?