Reputation: 23221
I've downloaded a nodejs project from Github, edited the source to add missing functionality and now I'm trying to compile it into an executable or run it uncompiled (node main.js
). In both cases I get messages that it can't find its dependencies.
This is not my normal programming language, so I'm unfamiliar with how node dependencies work.
The dependencies in questions are other node packages. I installed them with npm install -g
but that didn't help.
In the package.json
file they are described as follows:
"dependencies": {
"@castlelemongrab/ioh": "^0.0.4",
"@castlelemongrab/strr": "^0.0.1",
"bent": "^7.3.6",
"jsDump": "^1.1.0",
"yargs": "^15.3.1"
},
The warning messages specify the dependencies beginning with @
as the ones that are missing. Although it's just a warning, the program fails to function and issues the same message when you attempt to use it, so it's effectively an error. I found this Stackoverflow post mentioning that you could define dependencies like this:
"dependencies": {
"public": "git://github.com/user/repo.git#ref",
"private": "git+ssh://[email protected]:user/repo.git#ref"
}
But that didn't seem to have any effect:
Error: Cannot find module '@castlelemongrab/ioh'
How should I resolve it? I tried going into the node_modules
directory and git clone
-ing the ioh
library into the @castlelemongrab
folder but that also led to some errors:
npm ERR! code EISGIT
npm ERR! path C:\...\node_modules\@castlelemongrab\ioh
npm ERR! git C:\...\node_modules\@castlelemongrab\ioh: Appears to be a git repo or submodule.
npm ERR! git C:\...\node_modules\@castlelemongrab\ioh
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
Additionally, since I have the production version of this package installed on my system and I don't want to overwrite it, if I change the "name" field in package.json
is that an effective and safe way to avoid conflicts?
Upvotes: 0
Views: 1506
Reputation: 23221
The solution was to git clone
the missing modules into node_modules and then to rm -rf
the .git
and .gitignore
.
Figured this out by trial and error. If anyone has a more complete and informed answer, please feel free to add it.
Upvotes: 1