Can't run the "npm init" command from the Dockerfile build?

I tried to run the RUN npm init command from the Dockerfile during the docker build but this returned the following: “The command '/ bin / sh -c npm init' returned a non-zero code: 1

It’s not possible? Should I always create an external package.json file and run npm install?

I thank you in advance for those who are willing to take this doubt away from me.