NPM 专家! NPM 是否需要与每个 JointsWP Gulp Sass 项目一起安装

NPM Experts! Does NPM need to be installed with every JointsWP Gulp Sass project

我正在使用 JointsWP(一个优秀的 Foundation 6 端口到 Wordpress)。

我使用的是 Sass 版本并且运行良好。但是,我似乎必须为每个项目安装 npm。这是必要的吗?

有没有办法在我的项目中全局安装 npm 并 link 到它?或者让项目自动找到它?

我认为您对命令 npm install 的实际作用感到困惑。 npm install 将项目的所有 npm 依赖项安装到 node_modules 目录中。它实际上并没有安装 npm。要 运行 npm install,您必须安装 Node.js(npm 包含在节点中)。

所以要回答你的问题,是的,每个项目都需要 运行 npm install

相关文章:Global vs Local installation

您可以使用以下命令全局安装 gulp sass:

npm 安装-g gulp-sass

上面 Colin Marshall 分享的文章很棒,完美地总结了答案。

In general, the rule of thumb is:

If you’re installing something that you want to use in your program, using require('whatever'), then install it locally, at the root of your project. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

所以回答你的问题,可能吗?是的

推荐吗?编号

https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/