Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

invalid name "@mozilla/raptor" when using npm link #8927

Closed
eliperelman opened this issue Jul 13, 2015 · 14 comments
Closed

invalid name "@mozilla/raptor" when using npm link #8927

eliperelman opened this issue Jul 13, 2015 · 14 comments

Comments

@eliperelman
Copy link

Trying to npm link from a git repo which defines a scoped npm package. Error ensues:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'link' ]
2 info using npm@2.11.3
3 info using node@v0.12.7
4 verbose stack Error: Invalid name: "@mozilla/raptor"
4 verbose stack     at ensureValidName (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:300:15)
4 verbose stack     at Object.module.exports.fixNameField (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:204:5)
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:30:38
4 verbose stack     at Array.forEach (native)
4 verbose stack     at normalize (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:15)
4 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:338:5)
4 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:113:5)
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:300:12
4 verbose stack     at evalmachine.<anonymous>:334:14
4 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:102:5
5 verbose cwd /home/rwood/mozilla-raptor
6 error Linux 3.13.0-46-generic
7 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "link"
8 error node v0.12.7
9 error npm  v2.11.3
10 error Invalid name: "@mozilla/raptor"
11 error If you need help, you may report this error at:
11 error     <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]

The package.json:

{
  "name": "@mozilla/raptor",
  "version": "1.0.0-beta1",
  "preferGlobal": true,
  "description": "CLI tool for Firefox OS Gaia performance tests",
  "keywords": [
    "testing",
    "firefox-os",
    "gaia",
    "performance",
    "b2g",
    "cli"
  ],
  "main": "index.js",
  "author": {
    "name": "Eli Perelman",
    "email": "eli@eliperelman.com"
  },
  "bin": {
    "raptor": "./bin/raptor"
  },
  "devDependencies": {},
  "dependencies": {
    "byline": "^4.2.1",
    "cli-table": "^0.3.1",
    "commander": "^2.8.1",
    "debug": "^2.2.0",
    "deepmerge": "^0.2.10",
    "influx": "^3.0.0",
    "marionette-apps": "^0.3.13",
    "marionette-client": "^1.7.6",
    "marionette-content-script": "^0.0.4",
    "marionette-file-manager": "^0.0.4",
    "marionette-helper": "^0.3.1",
    "marionette-plugin-forms": "^0.0.4",
    "marionette-settings-api": "^0.1.0",
    "promise": "^6.1.0",
    "sax": "^1.1.1",
    "stats-lite": "^1.0.3",
    "temp": "^0.8.3",
    "unzip": "^0.1.11",
    "validator": "^3.40.1",
    "xregexp": "^2.0.0"
  },
  "scripts": {},
  "maintainers": [
    {
      "name": "eliperelman",
      "email": "eli@eliperelman.com"
    },
    {
      "name": "rwood-moz",
      "email": "rwood@mozilla.com"
    }
  ],
  "directories": {}
}
@othiym23
Copy link
Contributor

Yep, this seems like a legit bug. We may not have time to fix it soon (although it might already be fixed in npm@3 – have you tried using the beta with this yet? Its behavior around npm link is considerably more careful than in older versions of npm), so if you wanted to take a stab at putting together a patch, it would be most appreciated.

@cchamberlain
Copy link

This is a bug that was introduced with npm 3 and only occurs with scoped packages due to an extra level of directory traversal not being taken into account. I fixed and pointed out where it's occurring here - #8874. I believe it's already getting fixed but if not I'd clean up and send a pull request.

@eliperelman
Copy link
Author

This is a bug that was introduced with npm 3

@cchamberlain this issue is happening on npm v2.11.3; am I missing something with your statement?

@cchamberlain
Copy link

@eliperelman - you are correct, it was pretty late last night and im going to blame it on that. Based on that I'm not sure if this is related or not. The error in 3.x is that it can't read property 0 of undefined but I was linking scoped packages prior to npm 3 without issue.

@cchamberlain
Copy link

@eliperelman - assume you've used npm adduser and the account you are installing with has access to the scoped package if it's private?

@eliperelman
Copy link
Author

@cchamberlain lol no worries. For what it's worth, this issue doesn't manifest on OS X, only on Ubuntu. I'll see if I can get the system information.

@eliperelman
Copy link
Author

@cchamberlain shouldn't need credentials when only doing an npm link on a local package, right?

@cchamberlain
Copy link

@eliperelman - I think that the only time I've seen issues with that is if my package is referencing another private module so yeah probably unrelated. I'm not sure what might be causing on Ubuntu only, do you normally have to install global packages with sudo on your machine?

@eliperelman
Copy link
Author

Heh, I'm playing man in the middle. @rwood-moz, you want to follow up?

@rwood-moz
Copy link

Thanks Eli.
@cchamberlain No, I can install global packages without sudo, for example I just tried this one and it worked fine: npm install -g jshint

@vvaidy
Copy link

vvaidy commented Mar 10, 2016

If it helps, I was still seeing this on Ubuntu 12.04.4 LTS but not with 14.04.2 LTS even though it appeared as if I had npm version 3.7.3 and node v5.8.0 on both ubuntu systems.

However, that turned out to be due to the old chris-lea PPA versions still lingering on the system. I was able to delete the PPA, delete the various old versions on the system, install the Linux binaries directly from the nodejs website and reinstall the package, and all looked good again. This is just FYI in case someone else finds this old thread ...

@dasilvacontin
Copy link

I'm able to npm link on a scoped package. OSX 10.10.5, node v5.10.1, npm v3.8.3.

(tested using this package, fyi)

@eliperelman
Copy link
Author

@dasilvacontin correct, this issue only manifests itself on Ubuntu that we knew of.

I haven't tested it out with updates to npm, so I may do that today and report back here.

@npm-robot
Copy link

We're closing this issue as it has gone thirty days without activity. In our experience if an issue has gone thirty days without any activity then it's unlikely to be addressed. In the case of bug reports, often the underlying issue will be addressed but finding related issues is quite difficult and often incomplete.

If this was a bug report and it is still relevant then we encourage you to open it again as a new issue. If this was a feature request then you should feel free to open it again, or even better open a PR.

For more information about our new issue aging policies and why we've instituted them please see our blog post.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants