dropbox-sdk-js
dropbox-sdk-js copied to clipboard
Can't run the JS examples local server - can't find dist\Dropbox-sdk.js
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.
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.
I thought this is the case, but build was failing for me too, so I used the dist file from the npm dropbox package.
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.
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
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?
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
Thanks! We'll look into it.
Documentation still wrong a year later
@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.
The ';' on windows is indeed an issue. Switching to '&' was the fix for the build.