0

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:

  • root-folder
    • client-package
    • create-my-app -index.js -package.json

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.