当我尝试使用创建package.json
文件时,npm init
不断收到以下信息:
npm http GET https://registry.npmjs.org/init
npm http 304 https://registry.npmjs.org/init
npm http GET https://registry.npmjs.org/daemon
npm http 304 https://registry.npmjs.org/daemon
init@0.1.2 node_modules/init
└── daemon@1.1.0
怎么了?我到处都看了,找不到答案。这是我运行以下命令时得到的:
Amens-Mac-mini:~ amenmojara$ npm init =ddd
npm http GET https://registry.npmjs.org/%3Dddd
npm http GET https://registry.npmjs.org/init
npm http 304 https://registry.npmjs.org/init
npm http 404 https://registry.npmjs.org/%3Dddd
npm ERR! 404 '%3Dddd' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.26/bin/node" "/usr/local/bin/npm" "install" "init" "=ddd"
npm ERR! cwd /Users/amenmojara
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/amenmojara/npm-debug.log
npm ERR! not ok code 0
尝试这个。
转到终端。
更改要在其中创建文件的目录位置。
cd your_destination_folder
键入npm init
,然后按Enter。
它要求name, version, description, entry point, test command, git repository, keywords, author, license
。传递这些值。
然后提示Is this ok? (yes)
。输入yes
。
欢呼,您的package.json
文件已创建。
我已经尝试过了,当我发布此问题时,我得到了您看到的结果。
我想,您可以尝试
sudo npm init
。它将要求管理员密码。我不确定是否有帮助,但至少要尝试一下。是的,我必须添加sudo nom init,它的工作原理谢谢