Tag: npm

Node.js项目依赖关系的过度recursion

因此,经过漫长的一天工作之后,我坐下来看到系统托盘中的Windows SkyDrive警报: Files can't be uploaded because the path of this file or folder is too long. Move the item to a different location or shorten its name. C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\grunt-contrib-nodeunit\node_modules\nodeunit\node_modules\tap\node_modules\runforcover\node_modules\bunker\node_modules\burrito\node_modules\traverse\example\stringify.js …有一段时间,我嘲笑这种技术限制。 但是,我想知道:Node项目中的目录recursion是否真的有必要? 看起来超出"angular-app\server\node_modules"的path只是整个项目的依赖关系,可能会更好地expression为: C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\grunt-contrib-nodeunit\ C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\nodeunit\ C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\tap\ C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\runforcover\ C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\bunker\ C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\burrito\ C:\Users\Matthew\SkyDrive\Documents\Projects\Programming\angular-app\server\node_modules\traverse\ 我之前并没有真正考虑过这个问题,因为与许多平台相比,Node的包pipe理似乎很神奇。 我会想象一些大规模的Node.js项目甚至包含许多重复的模块(具有相同或相似的版本),这些模块可以合并为较less的数量。 有人可能会认为: 由于重复的依赖关系,存储和传输的数据量增加,增加了开发软件的成本。 较浅的目录结构(特别是在这种情况下)通常更易于浏览和理解。 过长的path名称可能会在某些计算环境中导致问题。 我所build议的(如果这样的事情不存在)是一个Node模块,它: recursion扫描Node项目,收集嵌套的node_modules文件夹的列表,以及相对于项目的根目录埋藏的深度。 将每个嵌套的node_modules文件夹的内容移动到主node_modules文件夹中,编辑每个.js文件的require()调用,以便不引用任何引用。 处理重复依赖项的多个版本 如果没有别的,它会做一个有趣的实验。 你们有什么感想? 我可能遇到什么潜在的问题?

Sails.js 0.10发电机

即将到来的Sails.js 0.10具有自定义生成器。 (在撰写本文时,它目前是@ rc4) Sails github上有一个迁移页面 ,描述了如何优秀的生成器,但不是如何将它们安装到自己的应用程序中。 一些非常有趣的自定义生成器开始popup: 帆-产生-AUTH 帆-产生-一饮而尽,凉亭 第一个在npm上可用。 所以这是npm install ,发生器在我的应用程序中可用。 我想尝试第二个用Gulp取代Grunt ,但是我不能安装发生器。 任何人都可以解释如何安装自定义生成器并将其与Sails.js应用程序挂钩?

使用npm安装后无法运行grunt

我正在尝试安装和使用咕噜声。 我使用npm install grunt -g来安装 它似乎安装 – grunt@0.4.3 /Users/me/.node/lib/node_modules/grunt 当我在terminal打开一个新的标签,并运行咕噜我得到 -bash: grunt: command not found 我的path是这样的 $ echo $PATH /Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin 有什么build议? 这是杀了我。 我也安装了grunt-cli,仍然不能正常工作 – npm install grunt-cli -g /Users/me/.node/bin/grunt -> /Users/me/.node/lib/node_modules/grunt-cli/bin/grunt 我打开一个新标签 -bash: grunt: command not found 我使用节点安装程序安装节点。 我在OSX上。 我刚刚添加/.node/bin到我的path,请参阅下面 – echo $PATH /Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/.node/bin:/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/.node/bin:/opt/X11/bin:/usr/local/git/bin 它仍然没有工作。

nodejs npm安装错误,如何纠正?

我正在试图做一个项目,需要'ref'npm安装,我得到这个错误。 任何想法我怎么能纠正这一点? 我有nvm runnning和node -v = 0.10.26 ref@0.1.3 install / root / node -ffi-libvirt / nodejs-usage / ffi-libvirt / node_modules / ref 节点gyp重build gyp ERR! configure error gyp ERR! stack Error: EACCES, mkdir '/root/node-ffi-libvirt/nodejs-usage/ffi-libvirt/node_modules/ref/build' gyp ERR! System Linux 3.11.0-12-generic gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /root/node-ffi-libvirt/nodejs-usage/ffi-libvirt/node_modules/ref gyp ERR! node -v v0.10.15 gyp […]

有没有办法在package.json中检测需要编译的模块?

如果您的某个npm模块需要编译,则部署到azure站点将失败。 有没有一种简单的方法来审计packages.json,使不在Windows上的人可以更容易地知道他们什么时候会遇到问题?

如何用package.json中的最新版本更新npm模块?

这是正确的方式更新我的package.json文件中列出的所有模块到他们当前的版本? npm update –save 我问,因为我看到输出中的很多HTTP 304消息,build议资源已经存在(而不是http 200)。 这可能是说“没有更新”的方式,但我不确定。 注意:运行此命令后,以下是我的package.json文件。 我看到它增加了一个新的部分“依赖”,但只有2个项目提出了新的版本,似乎已经复制2.复制行为似乎很奇怪。 { "name": "myapp", "version": "0.1.0", "description": "hello world", "devDependencies": { "grunt": "~0.4.2", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-jshint": "~0.7.2", "grunt-contrib-csslint": "~0.2.0", "grunt-cordovacli": "~0.3.3", "grunt-contrib-concat": "~0.3.0" }, "dependencies": { "grunt-contrib-copy": "~0.4.1", "grunt-contrib-jshint": "~0.7.2", "grunt": "~0.4.4", "grunt-cordovacli": "~0.3.4" } }

如何删除HTTPS npm模块中的请求标头

我正在尝试从本地主机访问Google API。 铬说,由于起源,这是不可能的 XMLHttpRequest cannot load https://maps.googleapis.com/maps/api…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. 我正在使用https-browserify发出ajax请求。 options = { hostname: "maps.googleapis.com", port: 443, path: "/maps/api/….", method: "get", headers: { "Origin": null, "Referer": null } }; result = null; req = https.request(options, function(res) { res.on("data", function(chunk) { return […]

使用自制程序安装新节点后,执行“npm -g update”错误

我正在做一个新的节点通过自制软件安装,并没有安装任何其他模块。 如果我使用npm -g update进行全局更新,则会显示下面显示的所有错误。 怎么了? $ npm -g update npm http GET https://registry.npmjs.org/npm npm http 304 https://registry.npmjs.org/npm npm http GET https://registry.npmjs.org/npm/1.4.6 npm http 304 https://registry.npmjs.org/npm/1.4.6 npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm npm ERR! error rolling back at clobberFail (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/lib/utils/gently-rm.js:57:12) npm ERR! error rolling back at next (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/lib/utils/gently-rm.js:43:14) npm […]

为什么我的Goodreads API的请求返回undefined?

以下是我如何在NPM中使用请求模块的简短示例。 它返回undefined,我相当肯定我正确使用xml2js。 我是否滥用了请求模块中的“表单”选项将值传递给Goodreads API? 谢谢! var req = require('request'); var resp = req.get('https://www.goodreads.com/book/isbn_to_id', {form:{ 'key' : '*****************', 'isbn' : '9780060513030' }}); var parseString = require('xml2js').parseString; parseString(resp, function (err, result) { console.dir(result); });

节点无法在IIS中find模块,可以从提示中find

我通过npm install <module>安装了一些模块,当我在命令提示符下运行node时,我可以访问它们,但是当我使用iisnode在IIS下运行应用程序时,出现如下错误: Application has thrown an uncaught exception and is terminated: Error: Cannot find module 'formidable' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (C:\Program Files\iisnode\www\helloworld\hello.js:3:18) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) 到底是怎么回事? 如果我使用iisnode是否有另外一种方法来安装模块? 这是我的项目web.config文件: <configuration> <system.webServer> <!– indicates […]