Package.json-无法安装模块 [英] Package.json - not able to install the modules

查看:17
本文介绍了Package.json-无法安装模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个空文件夹,我在其中创建了一个package.json文件,其中包含以下内容:

{
    "name":"sample project",
    "version":"0.0.1",
    "title":"My grunt App",
    "homepage":"http://gruntjs.com"
}

稍后在同一文件夹中,我尝试运行此命令:

npm install grunt --save-dev

但我收到的错误如下:根本无法安装咕噜声

D:grunt2>npm install grunt --save-dev
npm ERR! Error: Invalid name: "sample project"
npm ERR!     at ensureValidName (C:Program Files (x86)
odejs
ode_modules
pm
node_modules
ead-package-json
ode_modules
ormalize-package-datalibfixer.js:
300:15)
npm ERR!     at Object.module.exports.fixNameField (C:Program Files (x86)
odej
s
ode_modules
pm
ode_modules
ead-package-json
ode_modules
ormalize-package
-datalibfixer.js:204:5)
npm ERR!     at C:Program Files (x86)
odejs
ode_modules
pm
ode_modules
ead
-package-json
ode_modules
ormalize-package-datalib
ormalize.js:30:38
npm ERR!     at Array.forEach (native)
npm ERR!     at normalize (C:Program Files (x86)
odejs
ode_modules
pm
ode_m
odules
ead-package-json
ode_modules
ormalize-package-datalib
ormalize.js:29
:15)
npm ERR!     at final (C:Program Files (x86)
odejs
ode_modules
pm
ode_modul
es
ead-package-json
ead-json.js:342:33)
npm ERR!     at then (C:Program Files (x86)
odejs
ode_modules
pm
ode_module
s
ead-package-json
ead-json.js:126:33)
npm ERR!     at C:Program Files (x86)
odejs
ode_modules
pm
ode_modules
ead
-package-json
ead-json.js:316:48
npm ERR!     at fs.js:207:20
npm ERR!     at OpenReq.Req.done (C:Program Files (x86)
odejs
ode_modules
pm

ode_modulesgraceful-fsgraceful-fs.js:144:5)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program File
s (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "grunt" "--save-d
ev"
npm ERR! cwd D:grunt2
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     D:grunt2
pm-debug.log
npm ERR! not ok code 0

无法理解该问题。有谁能帮帮我吗? 实际上,我正在尝试复制此教程:http://www.anujgakhar.com/2013/02/28/writing-a-simple-grunt-task-using-gruntjs/

推荐答案

不要在项目名称中使用空格。把(如)改成sample-project。 (这是第一个错误行,btw:Error: Invalid name: "sample project")

这篇关于Package.json-无法安装模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆