Tag: npm

使用grunt插件

我有以下gruntfile module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), htmlhint: { build: { options: { 'tag-pair': true, 'tagname-lowercase': true, 'attr-lowercase': true, 'attr-value-double-quotes': true, 'doctype-first': true, 'spec-char-escape': true, 'id-unique': true, 'head-script-disabled': true, 'style-disabled': true }, src: ['index.html'] } }, watch: { html: { files: ['index.html'], tasks: ['htmlhint'] } } }); require("matchdep").filterDev("grunt-").forEach(grunt.loadNpmTasks); grunt.registerTask('default', ['watch']); }; 而当我尝试在CMD运行grunt它给了我这个错误 警告:找不到任务“默认”。 […]

如何实现头盔到节点服务器?

我正在尝试第一次使用npm模块,我试图将helmet到服务器模块中来设置安全标题。 我知道helmet是为了Express但我不使用Express 。 我还可以在以下服务器模块中使用“头盔”吗? 如果是这样,我该怎么做(代码示例将不胜感激)? 如果没有,我可以使用什么“插件”到下面的模块,或者我应该以不同的方式攻击? Thx为您的帮助/input。 'use strict'; var helmet = require('helmet') , web = require('node-static') , chalk = require('chalk'); var server; module.exports = plugin; function plugin(options) { var defaults = { cache: 0 , port: 8080 , host: "localhost" , verbose: false }; var opts = options || {}; setDefaults(opts, defaults); return function(files, […]

Msysgit上的节点cli在WIndows 10上

我最近决定在我的个人笔记本电脑上升级到Windows 10,并且节点cli在我试图运行时似乎挂起。 简单地在控制台上inputnode将不会启动界面,而且还需要按Ctrl + C来完成其他操作。 另外,运行一些npm命令比我在笔记本电脑上花费的时间要长。 更明显的是,在确认要写入package.json的信息后, npm init似乎挂起。 节点版本是4.0.0 npm版本是2.14.2 在Windows 10上有没有Node和npm的已知问题? 编辑:经过一些疑难解答,我已经找出了错误只发生在Msysgit。 在Windows的标准命令提示符下,这两个问题都不会发生。

npm下载phonegap多个错误

我试图从命令行下载npm的phonegap,我得到总是与节点版本的错误:4.0.0和4.1.0具体: 这 我在公司代理,我不能改变连接。 现在将节点的版本更改为:0.10.0我得到这些错误: npm ERR! Error: ENOENT, open 'C:\Documents and Settings\gcappella\node_modules\p honegap\node_modules\prompt\node_modules\utile\node_modules\mkdirp\test\return_s ync.js' npm ERR! If you need help, you may report this log at: npm ERR! <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR! <npm-@googlegroups.com> npm ERR! System Windows_NT 5.1.2600 npm ERR! command "C:\\Programmi\\nodejs\\\\node.exe" "C:\\Programmi\\nodejs\\nod e_modules\\npm\\bin\\npm-cli.js" "install" "phonegap" npm ERR! cwd C:\Documents […]

npm在安装我未指定的模块时会出错

我正在尝试安装我的应用程序使用所需的模块 npm install 当我这样做,我得到以下错误: npm ERR! Error: No compatible version found: gulp-util@'^3.0.0' npm ERR! Valid install targets: npm ERR! ["0.0.1","1.0.0","1.1.0","1.1.1","1.2.0","1.3.0","2.0.0","2.1.1","2.1.2","2.1.3","2.1.4","2.2.0","2.2.1","2.2.2","2.2.3","2.2.5","2.2.6","2.2.7","2.2.8","2.2.9","2. 2.10","2.2.11","2.2.12","2.2.13","2.2.14","2.2.15","2.2.16","2.2.17","2.2.18","2.2.19","2.2.20","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6"] 不过,我从来不需要把这个模块放到我的项目中。 我假设这是npm或节点的内部问题。 而且,当我跑步的时候也很奇怪 npm list -g 我得到下面的输出,而不是看到安装的npm版本。 ├── node@0.0.0 我的package.json文件是: { "name": "myProject", "version": "0.0.1", "dependencies": {}, "scripts": { "test": "gulp test" }, "devDependencies": { "browserify": ">=9.0.7", "gulp": ">=3.8.11", "gulp-concat": ">=2.6.0", "gulp-html-replace": ">=1.5.1", "gulp-react": […]

Visual Studio Online中的npm安装失败

我有一个Web应用程序与前端构build与Angular和后端与MVC,WebApi构build。 我正在Visual Studio Online上创build一个CI环境。 现在,npm安装和运行grunt任务由.cmd文件处理,并包含在Visual Studio Web项目的生成过程中。 当我在VSO中添加构build步骤时,我将构build步骤分离到了NuGet安装,解决scheme构build,npm安装,grunt任务运行等(我已经从项目中删除了.cmd文件的执行)。 但是,当npm安装步骤正在发生,它会失败,并出现以下错误。 ****************************************************************************** Starting task: npm install ****************************************************************************** Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\NpmInstall\0.1.3\NpmInstall.ps1 C:\Program Files\nodejs\npm.cmd install npm WARN package.json grunt-XXXXXXX-Identity@0.1.0 No description npm WARN package.json grunt-XXXXXXX-Identity@0.1.0 No README data npm WARN package.json grunt-XXXXXXX-Identity@0.1.0 No license field. npm WARN peerDependencies The peer dependency tslint@^2.0.1 included from grunt-tslint will no […]

Nodejs:如何解决Windows兼容性问题的一个模块?

我正在使用nodejs来编写一个命令行工具。 Windows报告错误。在Linux和Mac OSX系统上没有问题。 https://www.npmjs.com/package/idoc 全局安装npm install idoc -g 。 运行idoc init命令。你可以重现这个错误。依赖查询者错误。 错误信息 C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:549 throw e; ^ TypeError: Cannot read property 'substring' of undefined at Interface.rl._getCursorPos (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\ node_modules\readline2\index.js:55:51) at ScreenManager.render (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\ut ils\screen-manager.js:19:27) at Prompt.render (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\prompts\i nput.js:75:15) at Prompt._run (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\prompts\inp ut.js:49:8) at […]

npm在多域git存储库上安装失败

我们有一个新的项目,我们把它放在我们自己的Gitlab服务器上。 我从中克隆出来的 git@git.myacme.com:webapplication/app.git 成功。 假设我在gitlab中的用户名是scott@myacme.com。 我们在Github也有一个现有的项目,我使用的用户名是scott@yahoo.com 在新项目中,我们在package.json中有一个指向现有项目的入口。 记下https https://github.com/myacme/system-application.git 现在,当我执行npm install的时候,它试图在github.com上拉现有的项目时失败了。 这是说无效的用户名或密码….身份validation失败。 我认为它仍然使用scott@myacme.com而不是scott@yahoo.com 我不能更改package.json。 我正在考虑改为git链接,而不是https,但我会影响其他开发人员。 如果我这样做,我想它会使用我放在.ssh / config中的设置。 我添加了2个主机,我们的myacme.com和github.com 什么是这个解决方法? 我已经尝试使用我的雅虎电子邮件地址设置gitconfiguration全局user.name和user.email,但它仍然没有使用它。 我没有想法。 这是npm-debug.log文件中的确切错误 515 error git clone –template=/Users/scott/.npm/_git-remotes/_templates –mirror https://github.com/myacme/system-application.git /Users/scott/.npm/_git-remotes/https-github-com-myacme-system-application-git-0be15bdd: remote: Invalid username or password. 515 error git clone –template=/Users/scott/.npm/_git-remotes/_templates –mirror https://github.com/myacme/system-application.git /Users/scott/.npm/_git-remotes/https-github-com-myacme-system-application-git-0be15bdd: fatal: Authentication failed for 'https://github.com/myacme/system-application.git/'

如何解决npm peer dependency问题?

我有一个package.json具有以下冲突的模块: react-router需要react 0.13.x redbox-react哪个需要react@>=0.13.2 || ^0.14.0-rc1 react@>=0.13.2 || ^0.14.0-rc1 我只是做了一个npm install react ,它安装react@0.14 我正在尝试安装react-bootstrap ,它需要react@>=0.14.0 。 我已经有几个解决scheme: 每次更新时,从所有依赖关系的node_modules中删除node_modules 每次遇到问题时删除并重新安装所有模块 升级到npm 3.x,这仍​​然是预发布和 什么是解决这些问题的好方法,而不需要做npm版本不可知的1或2。 PS:这里提到的所有模块都已经在本地安装了。

本地NPM模块(npm链接)部署到Heroku

我正在使用npm链接添加我的本地模块到我的应用程序。 它在我的本地机器上工作得很好,但是当我运行grunt并把它推到Heroku时,它说我的模块没有find! 我有一个单一的回购一切。 我应该为NPM私人存储库支付每月$ 7吗? 那是我最后的手段 任何想法如何得到这个工作? PS发布我的私有模块到公共NPM不是一个选项,它是一个数据库模式模块在多个应用程序中使用。 我不想在任何地方复制和粘贴我的数据库模式 由于Git的文件名大小限制,手动将本地模块复制到node_modules中也不是一个选项: fatal: unable to stat : Filename too long Use –force to continue.