简体   繁体   English

本地gulp安装后缺少node_modules

[英]node_modules missing after local gulp install

I ran into an issue today mid-class. 我在课堂上遇到了一个问题。 I was showing my class how to install and use gulp.js, so I had to show the process on a projector. 我正在向我的班级展示如何安装和使用gulp.js,所以我必须在投影仪上显示该过程。

I've installed node.js and gulp.js globally with npm install -g gulp and it all works fine. 我用npm install -g gulp gulp全局安装了node.js和gulp.js,一切正常。

But when I try to install gulp locally in the project folder I am working on, it looks like gulp is installed, but the node_modules folder is never created. 但是当我尝试在我正在处理的项目文件夹中本地安装gulp时,它看起来像是安装了gulp,但是从不创建node_modules文件夹。

I tried refreshing, I tried running the command prompt as admin, I've checked for hidden folders, nothing works. 我尝试刷新,我尝试以管理员身份运行命令提示符,我检查了隐藏文件夹,没有任何效果。 --- I even restarted and tried again, cause Windows. ---我甚至重新启动并再次尝试,导致Windows。

I am working on windows 10. 我在Windows 10上工作。

Transcript of command line output: 命令行输出的脚本:

C:\Xampp\htdocs\test> node -v
v4.2.4

C:\Xampp\htdocs\test> npm -v
2.14.12

C:\Xampp\htdocs\test> gulp -v
[16:40:28] CLI version 3.9.1
[16:40:28] Local version 3.9.1

C:\Xampp\htdocs\test> npm install --save-dev gulp
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
gulp@3.9.1 ..\..\..\node_modules\gulp
├── interpret@1.0.1
├── pretty-hrtime@1.0.3
├── deprecated@0.0.1
├── archy@1.0.0
├── minimist@1.2.0
├── tildify@1.2.0 (os-homedir@1.0.2)
├── semver@4.3.6
├── v8flags@2.0.11 (user-home@1.1.1)
├── chalk@1.1.3 (escape-string-regexp@1.0.5, supports-color@2.0.0, ansi-styles@2.2.1, strip-ansi@3.0.1, has-ansi@2.0.0)
├── orchestrator@0.3.8 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
├── gulp-util@3.0.8 (array-differ@1.0.0, lodash._reescape@3.0.0, beeper@1.1.1, lodash._reevaluate@3.0.0, array-uniq@1.0.3, object-assign@3.0.0, lodash._reinterpolate@3.0.0, dateformat@2.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, fancy-log@1.3.0, vinyl@0.5.3, gulplog@1.0.0, lodash.template@3.6.2, through2@2.0.3, multipipe@0.1.2)
├── vinyl-fs@0.3.14 (strip-bom@1.0.0, vinyl@0.4.6, defaults@1.0.3, graceful-fs@3.0.11, through2@0.6.5, mkdirp@0.5.1, glob-stream@3.1.18, glob-watcher@0.0.6)
└── liftoff@2.3.0 (lodash.isstring@4.0.1, lodash.isplainobject@4.0.6, lodash.mapvalues@4.6.0, extend@3.0.0, rechoir@0.6.2, flagged-respawn@0.3.2, resolve@1.2.0, fined@1.0.2, findup-sync@0.4.3)

Note: npm is in my PATH. 注意:npm在我的PATH中。

You need either package.json or folder named node_modules in the current directory. 您需要当前目录中的package.json或名为node_modules文件夹。 If you are not going to have one, npm will look for either one in the parent directories. 如果您不打算使用一个, npm将在父目录中查找其中任何一个。 Check answer to NPM Installs Package Outside Current Directory for more details. 查看当前目录外的NPM安装包的答案以获取更多详细信息。

Also it is advised to start with npm init which will create package.json for you. 另外建议从npm init开始,这将为你创建package.json

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

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