[英]Newbie to Node.Js and NPM
想要在圣诞节期间使用node.js创建项目,并且正在使用本月.Net杂志的教程来帮助我。 由Henrik Joretag撰写我认为这很简单,但我似乎在第一道障碍遇到了问题。
在编写package.json文件时,我尝试运行它。 我受到以下错误的欢迎。
error TypeError: Cannot call method 'replace' of undefined
error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read- json.js:332:45
error at fs.js:117:20
error at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:53:5
error at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:62:5
error at Object.oncomplete (fs.js:297:15)
我完全迷失了如何配置它,因为教程已经声明在创建一个package.json文件后它应该可以工作。 我的package.json看起来像这样。
{
"name": "sample-dashboard.iwishiwaschucknorris.com",
"version" : "0.0.1",
"homepage" : "http://sample-dashboard.iwishiwaschucknorris.com",
"description" : "Mind-meldification for teams",
"dependencies" : {
"backbone" : "",
"underscore" : "",
"express" : "",
"stitch" : "",
"andbang-express-auth" : "",
"precommit-hook" : "",
"clientmodules" : "",
"templatizer" : "",
"andlog" : "",
"getconfig" : "",
"connect-githead" : ""
},
"clientmodules" : ["andlog","backbone","underscore"],
"main" : "server.js",
"scripts" : {
"postinstall" : "node node_modules/clientmodules/install.js"
}
}
任何有关这方面的帮助都会很棒,因为我真的很想进入node和backbone.js。
我有同样的问题。
根据这篇文章 ,我发现我已经完成了一个git init
但需要更进一步让npm
感到高兴。
我继续做了一个git add .
并在目录中使用git commit -m "<msg>"
来获取我在git元数据中记录的第一个提交。 然后我重新启动了npm install
,一切都很顺利。
也许你只是不从package.json
目录中运行npm install
,它将在本地安装package.json
声明的所有dependencies
,并运行postinstall
脚本。
这可能是我们最近修复的一个旧的npm错误。 npm update -g npm
你将全部完成。 (当有.git但没有git HEAD时会发生这种情况)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.