This is my package.json
for the module that I\'m including in the parent project:
{
\"version\": \"0.0.1\",
\"name\": \"module-name\",
\"d
if you inherited this code, it could be that the dependencies and versions were locked and you have a ./npm-shrinkwrap.json file.
if your dependency is not listed in that file, it will never get installed with the npm install
command.
you will need to manually install the packages and then run npm shrinkwrap
to update the shrinkwrap file.
I suspect you're facing the issue where your package.json
file is not in the same directory as your Gruntfile.js
. When you run your grunt xxx
commands, you get error an message like:
Local Npm module "xxx" not found. Is it installed?
For now, the solution is:
npm install
to load them locallyIMHO, it is sad that we cannot have grunt resolve modules loaded from a parent npm module (i.e. package.json in a parent directory within the same project). The discussion here seems to indicate that it was done to avoid loading "global" modules but I think what we want is loading from "my project" modules instead.
OP may be true for an older version of node. However, I faced the same with node 4.4.1 as well.
It very well may be linked to the node version you are using. Try to upgrade to a latest version. Certain dependencies don't load transitively if they are incompatible with node version.
I found this by running npm update
.
After upgrading to latest version (4.4 -> 5.9); this got fixed.
I had very similar issue, removing entire node_modules
folder and re-installing worked for me. Learned this trick from the IT Crowd show!
rm -rf node_modules
npm install
Another way to work this around is to add this into your module package.json
scripts section
"preinstall": "npm install {Packages You depend on}"
what this will does is, it will install all packages needed by the module and you won't get that error.
In my case it helped to remove node_modules
and package-lock.json
.
After that just reinstall everything with npm install
.