I am aware of the other questions about this issue. The answers on them are of no help, however. I've been dealing with Node and npm for a few years and I've never come across something so confusing. This is my first time dealing with socket.io, however.
I've installed socket.io
as a dependency on a git submodule of my project:
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:
const io = require(".\\node_modules\\socket.io")(8099);
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'
I am at a loss to know what to do.
For context: This is in the middle of working on Davide Barranca's Native Photoshop Apps video course—Lesson #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
:
{
"name": "js-ps-app",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"nwdev": "concurrently --kill-others --raw \"npm:serve\" \".\\node_modules\\.bin\\run .\\nwdev\" --success 'first'",
"generator": "node --inspect .\\generator\\generator-core\\app -f .\\generator\\plugins -v"
},
"dependencies": {
"@mdi/font": "^3.6.95",
"core-js": "^3.6.5",
"roboto-fontface": "*",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vue-the-mask": "^0.11.1",
"vuetify": "^2.2.11",
"vuex": "^3.4.0"
},
"devDependencies": {
"7zip-bin-win": "^2.2.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"concurrently": "^5.3.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.1.0",
"node-sass": "^4.12.0",
"nw-vue-devtools-prebuilt": "0.0.10",
"nwjs-builder-phoenix": "^1.15.0",
"sass": "^1.19.0",
"sass-loader": "^8.0.2",
"vue-cli-plugin-vuetify": "~2.0.7",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.3.0"
}
}
And here's generator-starter
's package.json
, which is what needs socket.io
:
{
"name": "generator-starter",
"version": "1.0.0",
"description": "Blank Adobe Generator Plugin",
"main": "main.js",
"generator-core-version": "~3",
"menu": {
"id": "generator-starter",
"label": "Generator Plugin"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Davide Barranca",
"license": "ISC",
"dependencies": {
"engine.io": "^4.0.1",
"socket.io": "^2.3.0"
}
}
"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.
from Cannot find module 'socket.io'
No comments:
Post a Comment