mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.07k stars 52 forks source link

DEV ISSUE: npm ERR! No workspaces found: #153

Closed gc-octopis closed 12 months ago

gc-octopis commented 1 year ago

Excuse me,

Recently, I forked panwriter and just gonna start developing.

I have installed volta, cloned my repo and ran npm ci

then I tried npm run electron:dev

this error poped up:

[2] > panwriter@0.8.6 electron:tsc
[2] > tsc -p electron electron
[2] 
[1] npm ERR! No workspaces found:
[1] npm ERR!   --workspace=true
[1] 
[1] npm ERR! A complete log of this run can be found in: /home/octopis/.npm/_logs/2023-12-01T15_46_54_537Z-debug-0.log
[1] wait-on http://127.0.0.1:3000 && npm run electron:tsc -w exited with code 1
[2] error TS5042: Option 'project' cannot be mixed with source files on a command line.
[2] wait-on http://127.0.0.1:3000 && npm run electron:tsc -p electron && ELECTRON_IS_DEV=1 electron . exited with code 1

there were also some warnings while compiling, but I don't think it matters the error shown above, if needed I'll paste it later.

I've tested on both windows and ubuntu(Linux) both got the error above.


Does anyone know what cause the error? Or what I missed when installing? Thanks a lot.

mb21 commented 12 months ago

Ah yes, this broke after some dependency-update, possibly https://github.com/mb21/panwriter/commit/6ddb7bdfe3ca8b3504b0c31d027688cbda4dfb8b

Sorry, I meant to fix this... for the time being, you can run npm run start in one terminal (to start the react app), and then ELECTRON_IS_DEV=1 npm run electron in another terminal (to start the electron main process and browser).

mb21 commented 12 months ago

Ah, I think I fixed it with https://github.com/mb21/panwriter/commit/416a006a63e3685e3be46db9d600d424d883d645 ?

gc-octopis commented 12 months ago

Oh thanks a lot, after I copied the edited command to my project, it works on my linux machine.

but there is still some errors on the windows side, and I'll probably figure it out later since it seems to be a issue with the different OS or just different Node or React version.

gc-octopis commented 12 months ago

Well, the Windows' error turns out can be fixed with cross-env.

Just also install it after you run npm ci with the command below.

npm install cross-env

And add cross-env before all commands contains environment variables (basically when you see a = sign)

for example, the npm run electron:dev from package.json's command will turn to:

"electron:dev": "concurrently \"cross-env BROWSER=none npm start\" \"wait-on http://127.0.0.1:3000 && npm run electron:tsc && cross-env ELECTRON_IS_DEV=1 electron .\"",

(as you can see, I added cross-env twice before both environment variables, BROWSER=none and ELECTRON_IS_DEV=1)


Hope this will help any future developer who wants to work with Windows OS