Skip to content
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

'import' and 'export' may appear only with 'sourceType: module' error #1018

Closed
mkapiczy opened this issue Feb 21, 2018 · 2 comments
Closed

Comments

@mkapiczy
Copy link

If you're reporting a bug, please include input code, output documentation,
a description of what you expected to happen, and what happened instead.

npm run docs

> [email protected] docs /builds/project-0
> node ./node_modules/.bin/documentation build ./src/services/index.js --output ./docs --format html --config .documentation.yml --github

Error: Parsing file /builds/project-0/src/services/Auth.js: 'import' and 'export' may appear only with 'sourceType: module' (11:0)
    at Deps.parseDeps (/builds/project-0/node_modules/module-deps-sortable/index.js:467:28)
    at fromSource (/builds/project-0/node_modules/module-deps-sortable/index.js:402:44)
    at /builds/project-0/node_modules/module-deps-sortable/index.js:396:17
    at ConcatStream.<anonymous> (/builds/project-0/node_modules/module-deps-sortable/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.emit (events.js:165:20)
    at finishMaybe (/builds/project-0/node_modules/module-deps-sortable/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:475:14)
    at endWritable (/builds/project-0/node_modules/module-deps-sortable/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:485:3)
    at ConcatStream.Writable.end (/builds/project-0/node_modules/module-deps-sortable/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:455:41)
    at DuplexWrapper.onend (/builds/project-0/node_modules/readable-stream/lib/_stream_readable.js:570:10)
    at Object.onceWrapper (events.js:255:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] docs: `node ./node_modules/.bin/documentation build ./src/services/index.js --output ./docs --format html --config .documentation.yml --github`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] docs script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-02-20T12_37_07_578Z-debug.log
  • What version of documentation.js are you using?:

5.3.5

  • How are you running documentation.js (on the CLI, Node.js API, Grunt, other?):

Here is the strange thing. When In run it on my local environment everything works fine.
OS: OSX
Node: 9.5.0
npm: 5.6.0

But it does not in my docker container in gitlab-ci with the same version of node.
The docker image: https://hub.docker.com/r/mkapiczy/docker-java-node-chrome/

The error occured after webpack upgrade (from version 1 -> 3), but the project build and all tests run fine.

I saw the same error was already mentioned in:
#950 and #483

@tmcw
Copy link
Member

tmcw commented Feb 21, 2018

Closing, duplicate of #950

As you can probably deduce from the previous reports, this error crops up every once in a while, but nobody's been able to diagnose it and find a real cause, so there's no clear fix. We'd really appreciate any help distilling down a cause.

@tmcw tmcw closed this as completed Feb 21, 2018
@backspaces
Copy link

@mkapiczy Could you look at the end of #950 and try either:

  • delete node_modules, yarn/npm lockfiles etc
  • download your repo to a fresh dir and re-init. Remove lockfiles if in your repo.

Let us know if it works!

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

No branches or pull requests

3 participants