如果您只想使用该软件包,
$ npm install -g carto
应该足以让您入门。请注意,您可能需要使用sudo
该命令。
Node.js以名为“ npm”的软件包管理器为中心。每个npm项目在其根目录下都有一个package.json,用于指定其依赖项,包名称,版本等。通过查看carto的package.json,即使您成功安装了optimist,您也会遇到更多require
错误。
如果要开发包,请在使用Git克隆后运行
$ npm install
在目录中。这将为您安装所有依赖项(包括devDependencies
在安装软件包本身时未安装的依赖项)。
关于Node.js的工作方式,有很多教程,例如http://nodeguide.com/beginner.html。那些应该给你比这个答案更全面的看法。
使用适当的软件包管理器(如npm),您永远不应使用Internet上的随机脚本将其伪造为模块。
祝你好运!
现在知道了npm的工作原理,请进行更新,如果您想在本地安装npm,可以执行以下操作
# With Internet
# Make a cache
$ mkdir carto-cache
# Make a temporary directory where the initial copy of carto is installed
$ mkdir to-be-discarded
$ cd to-be-discarded
# Now install the package, and cache the package in carto-cache
$ npm install --cache ../carto-cache --prefix . carto
# You can now remove to-be-discarded, and copy carto-cache to wherever you want.
# Without internet
$ npm install --cache carto-cache --cache-min 999999999 -g carto
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句