npm install thr" path必须是string"类型错误

时间:2016-11-28 21:42:18

标签: node.js npm gulp npm-install

第一次尝试使用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"
  }
}

0 个答案:

没有答案