Is this the place to ask questions of npm?

56 views
Skip to first unread message

Steve Husting

unread,
Feb 27, 2015, 4:54:22 PM2/27/15
to nod...@googlegroups.com
npm and Nodejs are closely related to this newcomer, so I wonder if this is the place to ask about npm error messages. 

For instance, when I use npm run xxx command to execute a script in package.json, what does it mean when I get the following error lines?

npm successfully installed the package (this error applies to around 5-6 packages), as I can see by looking into my cordova project's /node_module folder. The error relates to "command not found," but I don't understand why because the package folder (/html5-lint) is in node_modules. 

Error: 

sh: html5-lint: command not found
npm ERR! Exit status 127

Aria Stewart

unread,
Feb 27, 2015, 5:08:56 PM2/27/15
to nod...@googlegroups.com
On Feb 26, 2015, at 6:39 PM, Steve Husting <steveh...@gmail.com> wrote:

npm and Nodejs are closely related to this newcomer, so I wonder if this is the place to ask about npm error messages. 

It is, though you may want to talk to the npm support channels too. Lots of options there.


For instance, when I use npm run xxx command to execute a script in package.json, what does it mean when I get the following error lines?

npm successfully installed the package (this error applies to around 5-6 packages), as I can see by looking into my cordova project's /node_module folder. The error relates to "command not found," but I don't understand why because the package folder (/html5-lint) is in node_modules. 

Look in node_modules/.bin/ -- the command should be there.

Does html5-lint actually export a bin file?

What's the command in package.json you're running?

Aria

Steve Husting

unread,
Feb 27, 2015, 9:50:43 PM2/27/15
to nod...@googlegroups.com
Thank you for replying. 

I ran locally: npm install html5-lint

Contents of package.json are (this validates):

{
    "name": "npmTest",
    "devDependencies": {
        "jshint": "latest",
        "optimg": "latest",
        "jpgo": "latest",
        "css-validator": "latest",
        "css-prettifier": "latest",
        "ycssmin": "latest",
        "html5-lint": "latest"
    },
    "scripts": {
        "lint": "jshint **.js",
        "png": "optimg",
        "jpg": "jpgo",
        "cssm": "ycssmin **.css",
        "cssv": "css-validator **.css",
        "cssp": "css-prettifier **.css",
        "html": "html5-lint **.html"
    }
}

I see that it appears in /node_modules but not in its /.bin folder. So I guess the problem is there. Not sure what to do next. 

Thanks!

Ryan Schmidt

unread,
Feb 27, 2015, 9:52:35 PM2/27/15
to nod...@googlegroups.com

On Feb 26, 2015, at 5:39 PM, Steve Husting wrote:

> sh: html5-lint: command not found
> npm ERR! Exit status 127

This error likely means there is no executable named "html5-lint" in any of the directories identified by your $PATH environment variable.


Aria Stewart

unread,
Feb 27, 2015, 9:56:55 PM2/27/15
to nod...@googlegroups.com

> On 27 Feb 2015, at 19:01, Steve Husting <steveh...@gmail.com> wrote:
>
> Thank you for replying.
>
> I ran locally: npm install html5-lint
>
> Contents of package.json are (this validates):
>
> {
> "name": "npmTest",
> "devDependencies": {
> "jshint": "latest",
> "optimg": "latest",
> "jpgo": "latest",
> "css-validator": "latest",
> "css-prettifier": "latest",
> "ycssmin": "latest",
> "html5-lint": "latest"

Goodness. These should probably be "^thelatestmajor" not "latest" (where thelatestmajor is the major version number of each dependency) -- this will break in the future when someone publishes new, incompatible versions.

But the problem is html5-lint -- it doesn't export a bin, an actual tool to use -- and it looks like that script doesn't exist at all. It's not a command line tool you can use, but a library you can require. See its README:

https://github.com/mozilla/html5-lint

Aria

Steve Husting

unread,
Mar 2, 2015, 10:38:49 AM3/2/15
to nod...@googlegroups.com
I used latest because that's what the example showed. I'll think about changing that.

I guess this package wasn't designed to be used in the way I thought. Next time I see that error I'll just look for another package. 

Thank you for your insights. I really appreciated it. 

Regards,
Steve

Steve Husting

unread,
Mar 2, 2015, 11:47:32 AM3/2/15
to nod...@googlegroups.com
So, for correct phrasing, instead of "latest" I should use "@1.0.1" or "1.0.1"? (I get this number from npm ls.)

Thanks again for helping. 

Aria Stewart

unread,
Mar 3, 2015, 11:46:29 AM3/3/15
to nod...@googlegroups.com

On Mar 2, 2015, at 10:55 AM, Steve Husting <steveh...@gmail.com> wrote:

So, for correct phrasing, instead of "latest" I should use "@1.0.1" or "1.0.1"? (I get this number from npm ls.)

Thanks again for helping. 

Generally: "^1.0.1". That means "Compatible with and at least 1.0.1"


Generally, most node modules follow semver, so you can use ^ versions like that, and it will Do The Right Thing.

Aria
Reply all
Reply to author
Forward
0 new messages