我用npm install -g gulp
全局安装了node.js和gulp.js,一切正常。
但是当我尝试在我正在处理的项目文件夹中本地安装gulp时,它看起来像是安装了gulp,但是从未创建node_modules文件夹。
我尝试刷新,我尝试以管理员身份运行命令提示符,我检查了隐藏文件夹,没有任何效果。 ---我甚至重新启动并再次尝试,导致Windows。
我正在使用Windows 10。
命令行输出的脚本:
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)
注意:npm在我的路径中。
答案 0 :(得分:2)
您需要当前目录中的package.json
或名为node_modules
的文件夹。如果您没有,npm
将在父目录中查找其中任何一个。查看NPM Installs Package Outside Current Directory的答案以获取更多详细信息。
此外,建议您从npm init
开始,为您创建package.json
。