OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
841 stars 208 forks source link

Platform not supported: linux #490

Closed nitingupta910 closed 5 years ago

nitingupta910 commented 5 years ago

Article URL

https://docs.microsoft.com/en-us/office/dev/add-ins/quickstarts/onenote-quickstart

Issue

I'm trying to create a simple addin for OneNote Web on a Linux (Fedora30) host machine. I created sample application with genertor-office, but start:web action is throwing this error: Platform not supported: linux.

$ yo office

? Choose a project type: Office Add-in Task Pane project
? Choose a script type: JavaScript
? What do you want to name your add-in? My Office Add-in
? Which Office client application would you like to support? OneNote

Once project is created, run:

$ npm run start:web

> office-addin-taskpane-js@0.0.1 start:web /home/nigupta/temp/My Office Add-in
> office-addin-debugging start manifest.xml web

Debugging is being started...
App type: web
Unable to start the dev server. Error: Platform not supported: linux
Debugging started.

I thought creating addin for OneNote Web would be allowed from any OS?

kbrandl commented 5 years ago

@nitingupta910 sorry to hear that you've run into this problem. I'm going to transfer this issue to the OfficeDev/generator-office repo so that the folks who maintain the Yeoman generator for Office Add-ins can provide feedback there.

bdrodriguez-cthr commented 5 years ago

I'm having the same issue.

Created the project as such:

$ yo office

? Choose a project type: Office Add-in Task Pane project
? Choose a script type: JavaScript
? What do you want to name your add-in? My Office Add-in
? Which Office client application would you like to support? Word

Then:

$ npm start

> office-addin-taskpane-js@0.0.1 start /mnt/c/Users/bdrod/My Office Add-in
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Unable to start the dev server. Error: Platform not supported: linux
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in. 
Error: Platform not supported: linux.        

Any progress on this? I haven't been able to find anything on the googles.

TCourtneyOwen commented 5 years ago

Sorry to hear you are having problems. Are you in fact trying to run your add-in on a Linux? If so, sideloading is not supported. You can manually register your add-in by following these steps: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/create-a-network-shared-folder-catalog-for-task-pane-and-content-add-ins. You can also manually register your add-in in Office Online by following these steps: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/sideload-office-add-ins-for-testing.

As for starting the dev-server, this is going to be a bit trickier, since we really don't have any support for Linux at all. You can try creating your own local https server running on port 3000 by doing something like the code below. For the dev-certificates, you can grab ones at https://github.com/OfficeDev/Office-Add-in-NodeJS-SSO/tree/master/Before/src/certs and copy them locally and then update the 'const cert' section below to point to the correct location where you copied the dev-certs. The just start your server by running 'node ' Once the dev-server is running, you can try opening your Office Add taskpane application.

Obviously, this is not quick and easy, but I hope this might be helpful to get your add-in working on Linux.

-Courtney

const fs = require('fs'); const https = require('https'); const express = require('express'); const bodyParser =require('body-parser'); const cors = require('cors'); const path = require('path');

const app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(cors()); app.use(morgan('dev')); app.use(express.static('dist')); / Turn off caching when debugging / app.use(function (req, res, next) { res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate'); res.header('Expires', '-1'); res.header('Pragma', 'no-cache'); next() });

const cert = {
    key: fs.readFileSync(path.resolve('./dist/certs/server.key')),
    cert: fs.readFileSync(path.resolve('./dist/certs/server.crt'))
};
https.createServer(cert, app).listen(3000, () => console.log('Server running on 3000'));
TCourtneyOwen commented 5 years ago

Btw, you can remove the 'app.use(morgan('dev'));' line from the sample code above

nitingupta910 commented 5 years ago

Thanks for detailed steps for starting dev server on Linux. I'm closing it for now but I would appreciate a more seamless Linux dev setup for Web/Office365 plugin work.

Fensterbank commented 5 years ago

@TCourtneyOwen thanks for your explanation.

As for starting the dev-server, this is going to be a bit trickier, since we really don't have any support for Linux at all.

Is there a chance to support Linux in the future? AFAIK you are already open-minded by supporting MacOS. Since Linux is widely used by web developers and since Add-in development is powered by web technologies without needing huge things like Visual Studio or similar anymore, I think more developers using Linux will make Office Add-ins in the future.

I did not find any other thread mentioning that error message, so maybe we could reopen that issue and keep it as a feature request?

cristenicu commented 4 years ago

If you are using Angular you can create a project using angular-cli and add the Office dependencies

You can find a complete tutorial here https://www.initgrep.com/posts/javascript/angular/microsoft-office-addin-using-angular-cli

fusiled commented 4 years ago

Applying the patches of the 3 commits of this pull request seem to solve the issue:

https://github.com/OfficeDev/Office-Addin-Scripts/pull/199

AnvarNazar commented 4 years ago

Sorry to hear you are having problems. Are you in fact trying to run your add-in on a Linux? If so, sideloading is not supported. You can manually register your add-in by following these steps: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/create-a-network-shared-folder-catalog-for-task-pane-and-content-add-ins. You can also manually register your add-in in Office Online by following these steps: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/sideload-office-add-ins-for-testing.

As for starting the dev-server, this is going to be a bit trickier, since we really don't have any support for Linux at all. You can try creating your own local https server running on port 3000 by doing something like the code below. For the dev-certificates, you can grab ones at https://github.com/OfficeDev/Office-Add-in-NodeJS-SSO/tree/master/Before/src/certs and copy them locally and then update the 'const cert' section below to point to the correct location where you copied the dev-certs. The just start your server by running 'node ' Once the dev-server is running, you can try opening your Office Add taskpane application.

Obviously, this is not quick and easy, but I hope this might be helpful to get your add-in working on Linux.

-Courtney

const fs = require('fs'); const https = require('https'); const express = require('express'); const bodyParser =require('body-parser'); const cors = require('cors'); const path = require('path');

const app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(cors()); app.use(morgan('dev')); app.use(express.static('dist')); / Turn off caching when debugging / app.use(function (req, res, next) { res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate'); res.header('Expires', '-1'); res.header('Pragma', 'no-cache'); next() });

const cert = {
    key: fs.readFileSync(path.resolve('./dist/certs/server.key')),
    cert: fs.readFileSync(path.resolve('./dist/certs/server.crt'))
};
https.createServer(cert, app).listen(3000, () => console.log('Server running on 3000'));

the link to certificates is expired. please update it.

bwong199 commented 4 years ago

Hi,

I just tried to deploy it to Azure and getting the

Error: Unable to sideload the Office Add-in. Error: Platform not supported: linux.

message.

Thanks.

aaronjconway commented 1 year ago

with increased prevalence of wsl, after three years, it would be nice to have out of the box support.