I have learned that a recent change caused generator-core to only load modules from its own directory or from the plugins in its sibling plugins directory. However, I am experiencing problems getting generator-core to load the modules from my plugin. I have detailed the issue thoroughly on SO, but here it is for completeness' sake.
I've installed socket.io as a dependency in the plugins/generator-starter directory:
npm install --save socket.io
Then I require it:
const io = require("socket.io")(8099);
However, when I attempt to run the app, I get an error:
[error:app 10:31:32.339 C:\Users\<username>\dev\projects\js-ps-app\generator\generator-core\app.js:336:37] Unable to load plugin at 'C:\Users\<username>\dev\projects\js-ps-app\generator\plugins\generator-starter': Could not load plugin at path 'C:\Users\<username>\dev\projects\js-ps-app\generator\plugins\generator-starter': Cannot find module 'socket.io'
When attempting to reference the module relatively:
The error seems to shift to engine.io, which isn't even referenced in my project:
[error:app 10:38:40.630 C:\Users\<username>\dev\projects\js-ps-app\generator\generator-core\app.js:336:37] Unable to load plugin at 'C:\Users\<username>\dev\projects\js-ps-app\generator\plugins\generator-starter': Could not load plugin at path 'C:\Users\<username>\dev\projects\js-ps-app\generator\plugins\generator-starter': Cannot find module 'engine.io'
For context: This is in the middle of working on Davide Barranca's Native Photoshop Apps video course—Lesson No.15, specifically. Adobe Generator is working and connecting to Adobe Photoshop just fine. You can see where this project stands currently at its repo.
"Running the app" means running npm run generator from the root of the project. It uses node to run app.js inside generator\generator-core, which takes the sibling directory generator\plugins as an argument.
So, even though socket.iois installed in the generator/plugins/generator-starter directory, I still receive the Could not load plugin[…] error message. The strict change to generator-core—in terms of which node_modules folders it uses—has broken my app.
I was having the same issue, this solved my issue.
use absolute path to start the app :
node --inspect .\app -f C:[full path to folder]\generator-assets -v
I have learned that a recent change caused generator-core to only load modules from its own directory or from the plugins in its sibling
plugins
directory. However, I am experiencing problems getting generator-core to load the modules from my plugin. I have detailed the issue thoroughly on SO, but here it is for completeness' sake.I've installed
socket.io
as a dependency in theplugins/generator-starter
directory:Then I
require
it:However, when I attempt to run the app, I get an error:
When attempting to reference the module relatively:
The error seems to shift to
engine.io
, which isn't even referenced in my project:For context: This is in the middle of working on Davide Barranca's Native Photoshop Apps video course—Lesson No.15, specifically. Adobe Generator is working and connecting to Adobe Photoshop just fine. You can see where this project stands currently at its repo.
For example, here's the main repo's
package.json
:And here's
generator-starter
'spackage.json
, which is what needssocket.io
:"Running the app" means running
npm run generator
from the root of the project. It uses node to runapp.js
insidegenerator\generator-core
, which takes the sibling directorygenerator\plugins
as an argument.So, even though
socket.io
is installed in thegenerator/plugins/generator-starter
directory, I still receive theCould not load plugin[…]
error message. The strict change togenerator-core
—in terms of whichnode_modules
folders it uses—has broken my app.