Skip to content

Error running documentation as a npm script in packages.json #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
newjam opened this issue Jan 26, 2016 · 6 comments
Closed

Error running documentation as a npm script in packages.json #339

newjam opened this issue Jan 26, 2016 · 6 comments
Labels

Comments

@newjam
Copy link

newjam commented Jan 26, 2016

I don't want to install documentation globally, but install it as a project dev dependency, so new developers only need to install the node dependency. I can then run documentation from npm by specify a script in packages.json(I abridged it to only show relevant details)

{
  "devDependencies": {
    "babel-core": "^6.4.5",
    "documentation": "^3.0.4"
  },
  "scripts": {
    "documentation": "documentation --format html --output documentation app/main.js"
  }
}

I can then run the documentation script.

newjam$ npm run documentation

> @ documentation /<project-directory>
> documentation --format html --output documentation app/main.js

/<project-directory>/node_modules/babelify/index.js:56
    if (!babel.canCompile(filename, extensions)) {
               ^
TypeError: undefined is not a function
    at /<project-directory>/node_modules/babelify/index.js:56:16
    at makeTransform (/<project-directory>/node_modules/documentation/node_modules/module-deps/index.js:251:21)
    at /<project-directory>/node_modules/documentation/node_modules/module-deps/index.js:226:9
    at Deps.getTransforms (/<project-directory>/node_modules/documentation/node_modules/module-deps/index.js:231:7)
    at /<project-directory>/node_modules/documentation/node_modules/module-deps/index.js:366:24
    at onresolve (/<project-directory>/node_modules/documentation/node_modules/module-deps/index.js:178:14)
    at /<project-directory>/node_modules/documentation/node_modules/module-deps/node_modules/browser-resolve/index.js:268:13
    at onfile (/<project-directory>/node_modules/documentation/node_modules/resolve/lib/async.js:51:21)
    at onex (/<project-directory>/node_modules/documentation/node_modules/resolve/lib/async.js:93:22)
    at /<project-directory>/node_modules/documentation/node_modules/resolve/lib/async.js:24:18

npm ERR! Darwin 15.2.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "documentation"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! @ documentation: `documentation --format html --output documentation app/main.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ documentation script 'documentation --format html --output documentation app/main.js'.
npm ERR! This is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     documentation --format html --output documentation app/main.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /<project-directory>/npm-debug.log

There seems to be a version conflict here. Like documentation requires a certain version of babel that has the canCompile method. However, it doesn't seem to verify that the version is correct. I don't know if there even is a fix. I just wanted to point out some friction when I tried to integrate this into my project.

@Guria
Copy link

Guria commented Jan 29, 2016

don't you forget build in your script?

@newjam
Copy link
Author

newjam commented Jan 29, 2016

I left out a lot out of package.json

I have a lot more dependencies, and I have a webpack build script as well. I just don't think those are necessary to show the issue.

@Guria
Copy link

Guria commented Jan 29, 2016

i mean shouldn't command be like: documentation build app/main.js --format html --output documentation

@tmcw
Copy link
Member

tmcw commented Mar 19, 2016

documentation specifies all versions of babel it needs: https://github.com/documentationjs/documentation/blob/master/package.json#L11-L17 - it's very likely that this is a npm bug.

@tmcw
Copy link
Member

tmcw commented May 22, 2016

@newjam any more details? I'm not finding any ways to debug this issue. Did the npm install go cleanly?

@tmcw tmcw added the support label May 22, 2016
@newjam
Copy link
Author

newjam commented May 26, 2016

@tmcw thanks for looking into this. I just tried this again, with [email protected] and [email protected] and it worked as expected.

@newjam newjam closed this as completed May 26, 2016
rhendric pushed a commit to rhendric/documentation that referenced this issue Sep 15, 2022
* Add example of using guards with case expression

* Apply review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants