Skip to content
Advertisement

Node “No such file or directory” with certain packages

I installed two packages via npm:

  • alsatian@1.0.0-alpha.7
  • gulp@3.9.1

As I am using nvm to manage my node versions, the CLI files for the two packages were installed at the following paths:

  • /home/james/.nvm/versions/node/v6.3.1/lib/alsatian/cli/alsatian-cli.js
  • /home/james/.nvm/versions/node/v6.3.1/lib/gulp/bin/gulp.js

When I run the command gulp, the command runs correctly. However when I run the command alsatian I get the following output:

: No such file or directory

I replaced both CLI files with the following code:

#!/usr/bin/env node
"use strict";

console.log("If you see this, it worked!");

When I typed the command gulp, I get the message If you see this, it worked!. However, when I type the command alsatian I get the same No such file or directory message as before.


Using the which command I am certain that the files I have modified are the correct files for the packages, and by using the stat command I can see that I have the same permissions for the package files.

Advertisement

Answer

This was caused by the CLI file for alsatian containing carriage return characters. Enforcing LF line endings solved the issue.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement