npm install throwing“path must be string”TypeError

第一次尝试node.js – 我碰到了一个绊脚石 – 我希望有人能帮助我:)

我试图安装任何与npm install在这个例子中,我正在运行到这个错误,我试图安装mongoose 。 谷歌似乎没有让我到任何地方。

 ➜ Beta git:(dev) ✗ npm install mongoose --save npm WARN deprecated find-file@0.1.4: Use the globby package instead > gifsicle@0.1.7 postinstall /Users/e042481/Projects/Beta/node_modules/gifsicle > node index.js path.js:7 throw new TypeError('Path must be a string. Received ' + inspect(path)); ^ TypeError: Path must be a string. Received { url: 'https://raw.github.com/imagemin/gifsicle-bin/v0.1.7/vendor/osx/gifsicle', name: 'gifsicle', os: 'darwin' } at assertPath (path.js:7:11) at Object.basename (path.js:1355:5) at /Users/e042481/Projects/Beta/node_modules/download/index.js:35:43 at each (/Users/e042481/Projects/Beta/node_modules/each-async/each-async.js:63:4) at module.exports (/Users/e042481/Projects/Beta/node_modules/download/index.js:33:5) at /Users/e042481/Projects/Beta/node_modules/bin-wrapper/index.js:108:20 at /Users/e042481/Projects/Beta/node_modules/bin-wrapper/index.js:141:24 at /Users/e042481/Projects/Beta/node_modules/bin-check/index.js:30:20 at /Users/e042481/Projects/Beta/node_modules/executable/index.js:39:20 at FSReqWrap.oncomplete (fs.js:111:15) > jpegtran-bin@0.2.8 postinstall /Users/e042481/Projects/Beta/node_modules/jpegtran-bin > node index.js path.js:7 throw new TypeError('Path must be a string. Received ' + inspect(path)); ^ TypeError: Path must be a string. Received { url: 'https://raw.github.com/imagemin/jpegtran-bin/v0.2.8/vendor/osx/jpegtran', name: 'jpegtran', os: 'darwin' } at assertPath (path.js:7:11) at Object.basename (path.js:1355:5) at /Users/e042481/Projects/Beta/node_modules/download/index.js:35:43 at each (/Users/e042481/Projects/Beta/node_modules/each-async/each-async.js:63:4) at module.exports (/Users/e042481/Projects/Beta/node_modules/download/index.js:33:5) at /Users/e042481/Projects/Beta/node_modules/bin-wrapper/index.js:108:20 at /Users/e042481/Projects/Beta/node_modules/bin-wrapper/index.js:141:24 at /Users/e042481/Projects/Beta/node_modules/bin-check/index.js:30:20 at /Users/e042481/Projects/Beta/node_modules/executable/index.js:39:20 at FSReqWrap.oncomplete (fs.js:111:15) > optipng-bin@0.3.11 postinstall /Users/e042481/Projects/Beta/node_modules/optipng-bin > node index.js path.js:7 throw new TypeError('Path must be a string. Received ' + inspect(path)); ^ TypeError: Path must be a string. Received { url: 'https://raw.github.com/imagemin/optipng-bin/v0.3.11/vendor/osx/optipng', name: 'optipng', os: 'darwin' } at assertPath (path.js:7:11) at Object.basename (path.js:1355:5) at /Users/e042481/Projects/Beta/node_modules/download/index.js:35:43 at each (/Users/e042481/Projects/Beta/node_modules/each-async/each-async.js:63:4) at module.exports (/Users/e042481/Projects/Beta/node_modules/download/index.js:33:5) at /Users/e042481/Projects/Beta/node_modules/bin-wrapper/index.js:108:20 at /Users/e042481/Projects/Beta/node_modules/bin-wrapper/index.js:141:24 at /Users/e042481/Projects/Beta/node_modules/bin-check/index.js:30:20 at /Users/e042481/Projects/Beta/node_modules/executable/index.js:39:20 at FSReqWrap.oncomplete (fs.js:111:15) boilerplate-with-gulp@1.0.0 /Users/e042481/Projects/Beta └── mongoose@4.7.0 npm WARN boilerplate-with-gulp@1.0.0 No description npm WARN boilerplate-with-gulp@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: gifsicle@0.1.7 (node_modules/gifsicle): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: gifsicle@0.1.7 postinstall: `node index.js` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: jpegtran-bin@0.2.8 (node_modules/jpegtran-bin): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: jpegtran-bin@0.2.8 postinstall: `node index.js` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: optipng-bin@0.3.11 (node_modules/optipng-bin): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: optipng-bin@0.3.11 postinstall: `node index.js` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 

感谢您的时间


运行npm ls gifscale返回

 ➜ Beta git:(dev) ✗ npm ls gifscale boilerplate-with-gulp@1.0.0 /Users/e042481/Projects/Beta └── (empty) npm ERR! code 1 

我正在运行v7.1.0的节点,和npm的3.10.9。


我的package.json文件 –

 { "name": "boilerplate-with-gulp", "version": "1.0.0", "description": "", "main": "gulpfile.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "gulp" }, "author": "", "license": "ISC", "dependencies": { "body-parser": "^1.15.2", "express": "^4.14.0", "express-handlebars": "^3.0.0", "mongodb": "^2.2.11", "passport-facebook": "^2.1.1" }, "devDependencies": { "browser-sync": "^2.8.2", "gulp": "^3.9.0", "gulp-autoprefixer": "^2.3.1", "gulp-concat": "^2.6.0", "gulp-csso": "^1.0.0", "gulp-image-optimization": "^0.1.3", "gulp-jshint": "^1.11.2", "gulp-sass": "^2.0.4", "gulp-sourcemaps": "^1.6.0", "gulp-uglify": "^1.2.0", "gulp-util": "^3.0.6", "jshint-stylish": "^2.0.1", "nodemon": "^1.11.0" } }