npm / npm

This repository is moving to: https://github.com/npm/cli
http://npm.community
17.53k stars 3.02k forks source link

npm ERR! Arguments to path.resolve must be strings after upgrade #10566

Closed dbortoluzzi closed 8 years ago

dbortoluzzi commented 8 years ago

Hi,

today I've updated nodejs to v.0.12.8. All it was fine, but when I build my application with strongloop (slc build -n -b), the building process hang up with this error:

lc build -n -b
Running `npm install --ignore-scripts`
Running `npm prune --production`
Running `npm --quiet pack`
Error on `npm --quiet pack`:
Failed to run `npm --quiet pack`:
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "--quiet" "pack"
npm ERR! node v0.12.8
npm ERR! npm  v2.14.9

npm ERR! Arguments to path.resolve must be strings
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/local/user/Sviluppo/app/npm-debug.log

I've tried also to update npm to 3.5.0. and the error is the same.

Here you can find the stack trace of npm:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/bin/npm', '--quiet', 'pack' ]
2 info using npm@3.5.0
3 info using node@v0.12.8
4 verbose node symlink /usr/bin/node
5 silly cache add args [ '.', null ]
6 verbose cache add spec .
7 silly cache add parsed spec { raw: '.',
7 silly cache add   scope: null,
7 silly cache add   name: null,
7 silly cache add   rawSpec: '.',
7 silly cache add   spec: '/home/local/user/Sviluppo/app',
7 silly cache add   type: 'directory' }
8 verbose addLocalDirectory /home/local/user/.npm/app/0.1.0/package.tgz not in flight; packing
9 info lifecycle app@0.1.0~prepublish: app@0.1.0
10 silly lifecycle app@0.1.0~prepublish: no script for prepublish, continuing
11 verbose tar pack [ '/home/local/user/.npm/app/0.1.0/package.tgz',
11 verbose tar pack   '/home/local/user/Sviluppo/app' ]
12 verbose tarball /home/local/user/.npm/app/0.1.0/package.tgz
13 verbose folder /home/local/user/Sviluppo/app
14 verbose stack TypeError: Arguments to path.resolve must be strings
14 verbose stack     at Object.posix.resolve (path.js:439:13)
14 verbose stack     at InstancePacker.Packer.applyIgnores (/usr/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:111:59)
14 verbose stack     at InstancePacker.BundledPacker.applyIgnores (/usr/lib/node_modules/npm/lib/utils/tar.js:135:40)
14 verbose stack     at InstancePacker.<anonymous> (/usr/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:181:17)
14 verbose stack     at Array.filter (native)
14 verbose stack     at InstancePacker.IgnoreReader.filterEntries (/usr/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:179:31)
14 verbose stack     at InstancePacker.<anonymous> (/usr/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:92:12)
14 verbose stack     at InstancePacker.<anonymous> (/usr/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:134:5)
14 verbose stack     at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:76:16
14 verbose stack     at fs.js:334:14
15 verbose cwd /home/local/user/Sviluppo/app
16 error Linux 3.13.0-37-generic
17 error argv "node" "/usr/bin/npm" "--quiet" "pack"
18 error node v0.12.8
19 error npm  v3.5.0
20 error Arguments to path.resolve must be strings
21 error If you need help, you may report this error at:
21 error     <https://github.com/npm/npm/issues>
22 verbose exit [ 1, true ]

I've tried to do:

If you want any other informations, tell me.

Thank you very much!

Best regards, Daniele

kenany commented 8 years ago

@dbortoluzzi Can I see the package.json?

dbortoluzzi commented 8 years ago
{
  "name": "XXX",
  "version": "0.1.0",
  "description": "XXX",
  "private": true,
  "repository": {
    "type": "git",
    "url": "XXX"
  },
  "main": "server/server.js",
  "scripts": {
    "pretest": "jshint .",
    "test": "grunt test"
  },
  "dependencies": {
    "JSONStream": "^1.0.6",
    "async": "^1.5.0",
    "compression": "^1.0.3",
    "cors": "^2.5.2",
    "csvtojson": "^0.4.3",
    "debug": "^2.2.0",
    "errorhandler": "^1.1.1",
    "fs": "0.0.2",
    "grunt": "^0.4.5",
    "line-by-line": "^0.1.3",
    "loopback": "^2.14.0",
    "loopback-boot": "^2.6.5",
    "loopback-datasource-juggler": "^2.19.0",
    "loopback-edge-arangodb": "^1.1.0",
    "loopback-sdk-angular": "^1.5.0",
    "md5": "^2.0.0",
    "meow": "^3.3.0",
    "node-geocoder": "^3.4.0",
    "q": "^1.4.1",
    "serve-favicon": "^2.0.1",
    "thread-sleep": "^1.0.4",
    "underscore": "^1.8.3"
  },
  "optionalDependencies": {
    "loopback-explorer": "^1.1.0"
  },
  "devDependencies": {
    "connect-livereload": "^0.5.3",
    "grunt": "^0.4.5",
    "grunt-autoprefixer": "^3.0.3",
    "grunt-concurrent": "^1.0.0",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-compass": "^0.7.2",
    "grunt-contrib-concat": "^0.4.0",
    "grunt-contrib-connect": "^0.8.0",
    "grunt-contrib-copy": "^0.6.0",
    "grunt-contrib-cssmin": "^0.10.0",
    "grunt-contrib-htmlmin": "^0.3.0",
    "grunt-contrib-imagemin": "^0.8.1",
    "grunt-contrib-jshint": "^0.10.0",
    "grunt-contrib-less": "^1.0.1",
    "grunt-contrib-uglify": "^0.6.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-docular": "^0.2.4",
    "grunt-filerev": "^2.0.0",
    "grunt-google-cdn": "^0.4.0",
    "grunt-karma": "^0.11.2",
    "grunt-loopback-sdk-angular": "^1.1.2",
    "grunt-newer": "^0.7.0",
    "grunt-ng-annotate": "^0.4.0",
    "grunt-nodemon": "^0.4.0",
    "grunt-svgmin": "^0.4.0",
    "grunt-usemin": "^2.1.1",
    "grunt-wiredep": "^1.7.0",
    "jasmine-core": "^2.3.4",
    "jshint": "^2.5.6",
    "jshint-stylish": "^1.0.0",
    "karma": "^0.12.37",
    "karma-jasmine": "^0.3.6",
    "karma-phantomjs-launcher": "^0.2.0",
    "load-grunt-tasks": "^0.6.0",
    "open": "0.0.5",
    "phantomjs": "^1.9.17",
    "time-grunt": "^1.0.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "bundleDependencies": [
    "compression",
    "cors",
    "errorhandler",
    "loopback",
    "loopback-boot",
    "loopback-connector-arangodb",
    "loopback-datasource-juggler",
    "loopback-explorer",
    "q",
    "serve-favicon",
    "underscore"
  ]
}
carmelolg commented 8 years ago

try to run in sequence: npm uninstall npm sudo npm install -g npm@2.11.2

and finally start deploy. Might be conflicts with previous version of npm.

Let me know if it works..

dbortoluzzi commented 8 years ago

I've tried now and it works.

Thank you very much!

cwalther commented 8 years ago

For the benefit of anyone else coming here in search of a solution: This is a bug in one of the packages you are bundling into your package, there is a package.json somewhere whose "main" property is not a string. An example is angular-ui/ui-grid#4743. This bug is exposed by npm >= 2.12.0 (specifically, 9583cc3).

boxed commented 7 years ago

@dbortoluzzi probably shouldn't have closed this ticket. It's pretty bad that there is no way to know WHICH package is broken from the error message. Downgrading to an old version of node is clearly not a solution.

carmelolg commented 7 years ago

I'm agree with you @boxed. Maybe since the date of this post something changed? Let me know

boxed commented 7 years ago

Would surprise me. It's certainly just as bad in the latest stable you get on mac with brew.