2013-05-03 34 views
1

我搞砸了,我尽了最大的努力来修复它,但没有运气。NPM安装模块到应用程序根目录

每当我在新节点项目上运行'npm install'时,它会将所有依赖项安装到应用程序的根目录中,而不是像/期望的默认应用程序那样在/ node_modules目录中。

对于示例 -

我的package.json

{ 
    "name": "hello-world", 
    "description": "hello world test app", 
    "version": "0.0.1", 
    "private": true, 
    "dependencies": { 
    "express": "3.x" 
    } 
} 

当我使用 '故宫安装' 我结束了这一点:

我试过我的设置PATH像这样的解决方案: How to use package installed locally in node_modules?

但这似乎并没有太大的作用。帮帮我?

+1

你可以发布你的'〜/ .npmrc'的内容吗? – adrianp 2013-05-03 13:06:59

+0

已更新 - 我想你可能会做些什么! – 2013-05-03 13:23:06

+0

'/ private/tmp/timothy/timothy_local_job_1367532952281_60137/.npmcfg'包含什么?另外,请注意您在该目录中设置了“cache”变量。 – adrianp 2013-05-03 13:23:49

回答

1

观察你的缓存变量在该目录设置

strict-ssl = false 
userconfig = /private/tmp/timothy/timothy_local_job_1367532952281_60137/.npmcfg 
cache = /Users/tomhorton/Documents/Repository/helpmestackoverflow 
root = ./node_modules 

提摩太的东西是,我立即安装之前,一切都haywire-

我删除模块那些东西和默认值已经接管。一切都很好!