Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript NPM将模块安装到应用程序根目录_Javascript_Node.js_Unix_Npm - Fatal编程技术网

Javascript NPM将模块安装到应用程序根目录

Javascript NPM将模块安装到应用程序根目录,javascript,node.js,unix,npm,Javascript,Node.js,Unix,Npm,我把事情搞砸了,我已经尽力去解决了,但是运气不好 每当我在新节点项目上运行“npm install”时,它都会将我的所有依赖项安装到应用程序的根目录,而不是像您在默认应用程序中所期望的那样安装在/node_modules/中 例如— mypackage.json { "name": "hello-world", "description": "hello world test app", "version": "0.0.1", "private": true, "depend

我把事情搞砸了,我已经尽力去解决了,但是运气不好

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

例如—

mypackage.json

{
  "name": "hello-world",
  "description": "hello world test app",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "express": "3.x"
  }
}
当我使用“npm安装”时,我的结果是:

我已尝试在以下解决方案中设置路径:

但这似乎没什么作用。帮忙

请注意,您已在该目录中设置了缓存变量

timothy的东西来自一个模块,我在一切都失控前不久安装了这个模块-


我删除了那些东西,默认值接管了。一切都很好

请注意,您已在该目录中设置了缓存变量

timothy的东西来自一个模块,我在一切都失控前不久安装了这个模块-


我删除了那些东西,默认值接管了。一切都很好


你能发布你的
~/.npmrc
的内容吗?更新了-我想你可能知道了什么!
/private/tmp/timothy/timothy\u local\u job\u 1367532952281\u 60137/.npmcfg
包含哪些内容?另外,请注意,您在该目录中设置了
cache
变量。我删除了这些内容,默认值取代了它们。一切都很好!如果你把它作为一个答案,我会接受你的。缓存变量的作用是什么?我在里面的时候应该把它拿出来吗?你回答了你自己的问题:)你能把你的
~/.npmrc
的内容贴出来吗?更新了-我想你可能知道什么了!
/private/tmp/timothy/timothy\u local\u job\u 1367532952281\u 60137/.npmcfg
包含哪些内容?另外,请注意,您在该目录中设置了
cache
变量。我删除了这些内容,默认值取代了它们。一切都很好!如果你把它作为一个答案,我会接受你的。缓存变量的作用是什么?我在里面的时候应该把它拿出来吗?你回答了你自己的问题:)
strict-ssl = false
userconfig = /private/tmp/timothy/timothy_local_job_1367532952281_60137/.npmcfg
cache = /Users/tomhorton/Documents/Repository/helpmestackoverflow
root = ./node_modules