简体   繁体   English

npm没有在项目目录中创建node_modules文件夹

[英]npm not creating node_modules folder in project directory

I am doing a small Sinatra project and I want to use Gulp. 我正在做一个小型Sinatra项目,我想使用Gulp。

I have node(v0.12.0), npm(2.13.1), gulp(3.9.0) installed. 我安装了node(v0.12.0),npm(2.13.1),gulp(3.9.0)。 I am in my project directory but when I try install a package like "npm install gulp-sass --save-dev", it doesn't create any "node_modules" folder in my project directory. 我在项目目录中,但是当我尝试安装“ npm install gulp-sass --save-dev”之类的软件包时,它不会在项目目录中创建任何“ node_modules”文件夹。 It seems to be installing the package in my user home directory. 似乎正在将软件包安装在我的用户主目录中。 Anything I am doing wrong? 我做错了什么?

From the npm documentation : npm文档中

Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a package.json file, or a node_modules folder. 从$ PWD开始,npm将沿着文件夹树移动,检查包含package.json文件或node_modules文件夹的文件夹。 If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. 如果找到这样的东西,则出于运行npm命令的目的,将其视为有效的“当前目录”。 (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.) (此行为受git的.git-folder在工作目录中运行git命令时的查找逻辑的启发和相似。)

If no package root is found, then the current folder is used. 如果找不到软件包根目录,则使用当前文件夹。

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

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