dropbox-sdk-js icon indicating copy to clipboard operation
dropbox-sdk-js copied to clipboard

Can't run the JS examples local server - can't find dist\Dropbox-sdk.js

Open ciufudean opened this issue 4 years ago • 10 comments

Describe the bug I am following the instructions at https://github.com/dropbox/dropbox-sdk-js/tree/main/examples/javascript to run the examples server. node server.js crashes with

e:\temp\dropbox-sdk-js\examples\javascript>node server.js
e:\temp\dropbox-sdk-js\node_modules\rollup-endpoint\index.js:15
    throw Error('[rollup-endpoint] File does not exist: ' + options.entry);
    ^

Error: [rollup-endpoint] File does not exist: e:\temp\dropbox-sdk-js\dist\Dropbox-sdk.js
    at Object.exports.serve (e:\temp\dropbox-sdk-js\node_modules\rollup-endpoint\index.js:15:11)
    at Object.<anonymous> (e:\temp\dropbox-sdk-js\examples\javascript\server.js:12:10)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

Versions

  • What version of the SDK are you using? 9.6.0
  • What version of the language are you using? node v14.16.0
  • Are you using Javascript or Typescript? JS
  • What platform are you using? (if applicable) Windows 10

Additional context Add any other context about the problem here.

ciufudean avatar Apr 15 '21 20:04 ciufudean

Apologies for the trouble! The current instructions for running the examples are out of date. I'll ask the team to fix that up. To get this running, you'll need to run npm run build in between running npm install and node server.js.

greg-db avatar Apr 15 '21 21:04 greg-db

I thought this is the case, but build was failing for me too, so I used the dist file from the npm dropbox package.

ciufudean avatar Apr 16 '21 05:04 ciufudean

I see, thanks for the information. Installing from a package manager is certainly fine, but if you'd like us to look into the build issue anyway, please share the error output you're getting from npm run build.

greg-db avatar Apr 16 '21 14:04 greg-db

e:\temp\dropbox-sdk-js>npm run build

[email protected] build e:\temp\dropbox-sdk-js npm run build:es && npm run build:cjs && npm run build:umd && npm run build:umd:min

[email protected] build:es e:\temp\dropbox-sdk-js cross-env BABEL_ENV=es babel src -d es/src; cross-env BABEL_ENV=es babel lib -d es/lib; cross-env BABEL_ENV=es babel index.js -d es

babel: cross-env does not exist BABEL_ENV=es does not exist babel does not exist npm ERR! code ELIFECYCLE npm ERR! errno 2

ciufudean avatar Apr 16 '21 20:04 ciufudean

Thanks! Those should have been installed by npm install. Did the npm install command also fail? Can you share the output for that if so?

greg-db avatar Apr 16 '21 21:04 greg-db

I found the cause. Your build:xx npm scripts are using ; as a command separator, while on Windows this is & or &&. And a few solutions here

ciufudean avatar Apr 16 '21 21:04 ciufudean

Thanks! We'll look into it.

greg-db avatar Apr 19 '21 16:04 greg-db

Documentation still wrong a year later

RichardJECooke avatar Aug 18 '22 13:08 RichardJECooke

@RichardJECooke Thanks for the note. This is still open with the team. I'll check in with them on this and follow up here with any updates.

greg-db avatar Aug 18 '22 15:08 greg-db

The ';' on windows is indeed an issue. Switching to '&' was the fix for the build.

matrix75 avatar Sep 15 '22 19:09 matrix75