Skip to content

Tag: npm

Is it possible to set the root directory of a node module?

If I publish a node module with source files in a src directory, and people would like to import a file in their project, they would need to specify the full path from the module. Example: Structure: package.json: Implementation: (or using require) Is there any way to set up the package so that it knows src i…

Running npm globally installed packages

Can someone please explain how do node’s globally installed behave. It is really confusing me. If I install a package (with executables) such as http-serverglobally I can run it with: But if I do I get I suspect my ternpackage in emacs is trying to run it with node hence breaking. Why is this happening?…

What is “entry point” in npm init

I have an empty new project, when i run npm init i got a list of questions to answer, for example: I am really confused about the one that says “entry point”, Should this be my index.html file or my app.js or is it something else? Answer Quoting from this blog post: Entry point is the javascript f…

jshint Error: Cannot find module ‘underscore’

My grunt task seems to be running perfectly fine, but every time I run it I’m getting this error: Is there any way to find out why this is happening? I can see the /grunt-contrib-jshint directory is in the /node_modules directory. Is there any reason it can’t find the underscore module? I’ve…

Sending command line arguments to npm script

The scripts portion of my package.json currently looks like this: …which means I can run npm start to start the server. So far so good. However, I would like to be able to run something like npm start 8080 and have the argument(s) passed to script.js (e.g. npm start 8080 => node ./script.js server 80…