gpt4 book ai didi

node.js - npm 未在项目目录中创建 node_modules 文件夹

转载 作者:太空宇宙 更新时间:2023-11-03 23:06:52 26 4
gpt4 key购买 nike

我正在做一个小型的 Sinatra 项目,我想使用 Gulp。

我安装了node(v0.12.0)、npm(2.13.1)、gulp(3.9.0)。我在我的项目目录中,但是当我尝试安装像“npm install gulp-sass --save-dev”这样的包时,它不会在我的项目目录中创建任何“node_modules”文件夹。它似乎正在将软件包安装在我的用户主目录中。我做错了什么吗?

最佳答案

来自npm documentation :

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. If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.)

If no package root is found, then the current folder is used.

关于node.js - npm 未在项目目录中创建 node_modules 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32158203/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com