Tag: npm

我怎样才能让多个项目共享node_modules目录?

每当我做项目,我都必须下载节点模块的所有依赖关系。 如果不复制node_modules,是否有共享多个项目中的中央node_modules? 像下面这样,我每次都要运行很多命令。 npm install gulp-usemin npm install gulp-wrap npm install gulp-connect npm install gulp-watch npm install gulp-minify-css npm install gulp-uglify npm install gulp-concat npm install gulp-less npm install gulp-rename npm install gulp-minify-html

节点js从文件获取文件夹path

有没有办法让path到一个文件夹保存一个特定的文件。 fs.realpathSync('config.json', []); 返回类似的东西 G:\node-demos\7-node-module\demo\config.json 我只需要 G:\node-demos\7-node-module\demo\ or G:\node-demos\7-node-module\demo\ 有没有这个或我会需要处理string?

有没有办法在一个npmrc文件中configuration多个registry

这是我的问题。 我们有一个私人NPMregistry,只能在VPN中工作。 我想有一个后备registryhttps://registry.npmjs.org,这样当我脱离VPM时,它可以无缝工作。 PS目前我正在使用npmrc ,它在切换.npmrc文件之间做了很好的工作

node.js模块path

我意识到,当我做了一个node.js模块的全局安装(使用-g标志),节点不能使用该模块,除非我写了整个path。 我的意思是,如果模块已经全局安装,这不起作用: cheerio = require('cheerio'), 我必须这样写: cheerio = require('/usr/lib/node_modules/cheerio'), 我怎么能说节点,它必须在正确的path寻找模块? 谢谢。

如何使用Nodejs创buildExcel文件?

我是一个nodejs程序员。 现在我有一个我想要以Excel文件格式保存的数据表。 我怎么去做这个? 我find了一些Node库。 但其中大多数是Excelparsing器,而不是Excel作家。我正在使用Linux服务器。 因此需要一些可以在Linux上运行的东西。 请让我知道是否有任何有用的图书馆,你知道的。 或者有没有一种方法可以将CSV文件转换为xls文件(以编程方式)?

Webpack – webpack-dev-server:命令未find

我正在使用webpack在一个React webapp上工作,松散地与本教程一起。 不小心,我添加了node_modules文件夹到我的git。 然后我使用git rm -f node_modules/*再次删除它。 现在,当我尝试启动webpack服务器时,出现以下错误: > webpack-dev-server -d –config webpack.dev.config.js –content-base public/ –progress –colors sh: webpack-dev-server: command not found npm ERR! Darwin 14.4.0 npm ERR! argv "node" "/usr/local/bin/npm" "run" "devserve" npm ERR! node v0.12.4 npm ERR! npm v2.10.1 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! […]

通过package.json安装“global”npm依赖关系

我有几个“全局”依赖(jshint,csslint,buster等),我想通过命令行自动安装和执行,当我的软件包通过npm install 。 这可能吗? 目前,我正在手动执行以下操作: npm install -g <package_name> 从我的项目中: npm link <package_name> 更新:刚刚遇到了npm的这个function请求 。 看起来像package.json中的scriptsconfiguration是要走的路? 再次更新:或者,阅读npm文档后 ,也许我应该使用.gyp文件 ? 我很困惑。

用grunt自动化npm和bower安装

我有一个node / angular项目,使用npm作为后端依赖pipe理,而bower作为前端依赖pipe理。 我想使用一个咕task任务来执行两个安装命令。 我一直无法弄清楚如何去做。 我试图使用exec ,但实际上并没有安装任何东西。 module.exports = function(grunt) { grunt.registerTask('install', 'install the backend and frontend dependencies', function() { // adapted from http://www.dzone.com/snippets/execute-unix-command-nodejs var exec = require('child_process').exec, sys = require('sys'); function puts(error, stdout, stderr) { console.log(stdout); sys.puts(stdout) } // assuming this command is run from the root of the repo exec('bower install', {cwd: './frontend'}, […]

节点gyp错误TRACKER:错误TRK0005:无法find:“CL.exe”。 该系统找不到指定的文件

我想安装Visual Studio社区2015,Python v2.7.3安装Windows 10机器上的bcrypt,但我得到以下错误。 节点版本v4.2.1 node-gyp v3.0.3 npm install bcrypt C:\Users\ASMIN\Desktop\M2\app>npm install bcrypt npm WARN package.json eapp@1.0.0 No description npm WARN package.json eapp@1.0.0 No repository field. npm WARN package.json eapp@1.0.0 No README data > bcrypt@0.8.5 install C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt > node-gyp rebuild C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node -gyp.js" rebuild ) else (node rebuild ) Building […]

npm找不到package.json

我试图安装我下载的一些示例Express应用程序的依赖关系,但所有的应用程序都抛出相同的错误: c:\node\stylus>npm install -d npm info it worked if it ends with ok npm info using npm@1.1.1 npm info using node@v0.6.11 npm ERR! Couldn't read dependencies. npm ERR! Error: ENOENT, no such file or directory 'c:\node\stylus\package.json' npm ERR! You may report this log at: npm ERR! <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR! […]