dropbox / dropbox-sdk-js

The Official Dropbox API V2 SDK for Javascript
https://www.dropbox.com/developers
MIT License
941 stars 354 forks source link

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

Open ciufudean opened 3 years ago

ciufudean commented 3 years ago

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

Additional context Add any other context about the problem here.

greg-db commented 3 years ago

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.

ciufudean commented 3 years ago

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

greg-db commented 3 years ago

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.

ciufudean commented 3 years ago

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

dropbox@9.6.0 build e:\temp\dropbox-sdk-js npm run build:es && npm run build:cjs && npm run build:umd && npm run build:umd:min

dropbox@9.6.0 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

greg-db commented 3 years ago

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?

ciufudean commented 3 years ago

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

greg-db commented 3 years ago

Thanks! We'll look into it.

RichardJECooke commented 2 years ago

Documentation still wrong a year later

greg-db commented 2 years ago

@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.

matrix75 commented 2 years ago

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