Reputation: 2600
according to the npm-docs the npm init
command can be used in conjunction with an init-script that would preconfigure a new package:
npm init <package>
where <package>
refers to a package called create-<package>
. I would like to create such a create-<package>
-thing, but npm is for some reason trying to execute my create-script with Microsoft JScript instead of node 🤔.
I have the following test-structure:
client-package
is the package that I want to initialize using npm init my-app
.
create-my-app
is the package that is supposed to contain the create-script. I've linked create-my-app
to client-package
using npm link create-my-app
inside of client-package
When I call npm init my-app
in client-package
npm locates the index.js
in create-my-app
and tries to execute it. But it does not execute it with node, instead it tries to execute it as a windows JScript... whatever that is... How can I tell npm that this is supposed to run with node?
Upvotes: 0
Views: 1210
Reputation: 24
If your script is intended to be executed by Node you should indicate it with the proper shebang
#!/usr/bin/env node
With that line, we are executing with a Node interpreter, using the env program search path to find it.
Upvotes: 1