for those of you who tried writing private modules in npm, I followed these instructions - https://docs.npmjs.com/private-modules/intro and https://docs.npmjs.com/getting-started/scoped-packages but my project can't seem to find the project when I require it like this:
var projectName = require("@username/project-name");
I get this error:
Cannot find module '@username/project-name'
Did I miss something or did I do anything wrong? All I ever did was following the instructions on the said links.
Though I also encountered some problems during the installation, I don't know why it's happening:
npm WARN saveError Problems were encountered
npm WARN saveError Please correct and try again.
npm WARN saveError extraneous: browserify-ngannotate@1.0.1 /home/bassist/Workspace/test/test-web/node_modules/browserify-ngannotate
npm WARN saveError extraneous: browserify-shim@3.8.10 /home/bassist/Workspace/test/test-web/node_modules/browserify-shim
npm WARN saveError extraneous: karma-browserify@4.4.0 /home/bassist/Workspace/test/test-web/node_modules/karma-browserify
npm WARN saveError invalid: have pm2-deploy@0.2.1 (expected: latest) /home/bassist/Workspace/test/test-web/node_modules/pm2/node_modules/pm2-deploy
npm WARN saveError extraneous: pm2-deploy@0.2.1 /home/bassist/Workspace/test/test-web/node_modules/pm2/node_modules/pm2-deploy
npm WARN saveError extraneous: watchify@3.4.0 /home/bassist/Workspace/test/test-web/node_modules/watchify
tv4@1.0.18 node_modules/tv4 -> node_modules/pm2/node_modules/pm2-deploy/node_modules/tv4
test-web@0.2.49 /home/bassist/Workspace/test/test-web
└── @username/project-name@1.0.0
npm WARN optional Skipping failed optional dependency /gulp-nodemon/nodemon/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.6
npm WARN optional Skipping failed optional dependency /karma/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.6
npm WARN optional Skipping failed optional dependency /karma-browserify/watchify/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.6
npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.6
npm WARN optional Skipping failed optional dependency /watchify/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.6
Edit: I reinstalled all my node_modules on my main app again and installed my custom module without any problems but still to no avail..
Here's my package.json contents (on the custom module)
{
"name": "@username/project-name",
"version": "1.0.3",
"description": "Separate module which can cater Mongo Data Service, and other services that access the Mongo database",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Simon Guillen <simonbass@gmail.com>",
"license": "ISC"
}
Disclaimer: My project is confidential that is why I'm using the @username/package-name as my sample scoped module name.