简体   繁体   English

npm不仅将模块安装到当前目录中,还将模块安装到node_modules中

[英]npm installs modules into current directory, not only node_modules

I tried to create new project and did like this. 我试图创建一个新项目并做到了这一点。

> express newproject

> cd newproject

> ls
app.js          package.json    public/         routes/         views/

> npm install

// ...

> ls
app.js                  commander/              cookie-signature/       formidable/             methods/                node_modules/           public/                 routes/
buffer-crc32/           connect/                debug/                  fresh/                  mime/                   package.json            qs/                     send/
bytes/                  cookie/                 express/                jade/                   mkdirp/                 pause/                  range-parser/           views/

Why the files are downloaded into current directory? 为什么将文件下载到当前目录? Is this a bug? 这是错误吗?

Resolved 解决

I resolved this issue by fixing ~/.npmrc. 我通过修复〜/ .npmrc解决了此问题。

- cache = .
+ cache = ~/.npm

It works! 有用!

Resolved 解决

I resolved this issue by fixing ~/.npmrc. 我通过修复〜/ .npmrc解决了此问题。

- cache = .
+ cache = ~/.npm

It works! 有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM