hi-ko / joplin-server-ubuntu-install

install joplin-server on Ubuntu 20
16 stars 6 forks source link

Build fails on Ubuntu 20.04 (EACCES: permission denied) #1

Closed bernd-wechner closed 2 years ago

bernd-wechner commented 2 years ago

Following the README. I first did:

sudo bashjoplin-requirements.sh

and that worked well. Then progressed to the build:

$ sudo bash joplin-build.sh 
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated highlight.js@10.3.2: Potential vulnerability. Please upgrade to @latest
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

added 1585 packages, and audited 1586 packages in 2m

90 packages are looking for funding
  run `npm fund` for details

69 vulnerabilities (31 moderate, 38 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice 
npm notice New minor version of npm available! 8.1.2 -> 8.4.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.4.0
npm notice Run npm install -g npm@8.4.0 to update!
npm notice 

> bootstrap
> lerna bootstrap --force-local --no-ci

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Bootstrapping 8 packages
lerna info Installing external dependencies
lerna ERR! 
lerna ERR! lerna EACCES: permission denied, rename '/home/joplin/packages/fork-htmlparser2/package.json' -> '/home/joplin/packages/fork-htmlparser2/package.json.lerna_backup'

> bootstrapServerOnly
> lerna bootstrap --force-local --no-ci --include-dependents --include-dependencies --scope @joplin/server

lerna notice cli v3.22.1
lerna info versioning independent
lerna notice filter including "@joplin/server"
lerna notice filter including dependents
lerna notice filter including dependencies
lerna info filter [ '@joplin/server' ]
lerna info Bootstrapping 9 packages
lerna info Installing external dependencies
lerna ERR! 
lerna ERR! lerna EACCES: permission denied, rename '/home/joplin/packages/fork-htmlparser2/package.json' -> '/home/joplin/packages/fork-htmlparser2/package.json.lerna_backup'

> build
> lerna run build && npm run tsc

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Executing command in 4 packages: "npm run build"
lerna ERR! npm run build exited 127 in '@joplin/turndown-plugin-gfm'
lerna ERR! npm run build stdout:

> @joplin/turndown-plugin-gfm@1.0.42 build
> rollup -c config/rollup.config.cjs.js

lerna ERR! npm run build stderr:
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs'
}
sh: 1: rollup: not found

lerna ERR! npm run build exited 127 in '@joplin/turndown-plugin-gfm'
lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately.

Not sure what lerna is and why there are permission denied errors when run as root. Any tips appreciated.

bernd-wechner commented 2 years ago

I ran it again with tracing just to get closer to what's happening:

$ sudo bash -x joplin-build.sh 
[sudo] password for cirrus: 
+ cd /home/joplin
+ rm -f package-lock.json package.json
+ cp joplin/package-lock.json joplin/package.json ./
+ npm install --ignore-scripts

up to date, audited 1586 packages in 46s

90 packages are looking for funding
  run `npm fund` for details

69 vulnerabilities (31 moderate, 38 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
+ rm -rf packages
+ mkdir packages
+ rsync -r joplin/packages/fork-sax/package-lock.json joplin/packages/fork-sax/package.json ./packages/fork-sax/
+ rsync -r joplin/packages/htmlpack/package-lock.json joplin/packages/htmlpack/package.json ./packages/htmlpack/
+ rsync -r joplin/packages/renderer/package-lock.json joplin/packages/renderer/package.json ./packages/renderer/
+ rsync -r joplin/packages/tools/package-lock.json joplin/packages/tools/package.json ./packages/tools/
+ rsync -r joplin/packages/lib/package-lock.json joplin/packages/lib/package.json ./packages/lib/
+ rsync -r joplin/lerna.json .
+ rsync -r joplin/tsconfig.json .
+ rsync -r joplin/packages/turndown/ ./packages/turndown/
+ rsync -r joplin/packages/turndown-plugin-gfm/ ./packages/turndown-plugin-gfm/
+ rsync -r joplin/packages/fork-htmlparser2/ ./packages/fork-htmlparser2/
+ npm run bootstrap

> bootstrap
> lerna bootstrap --force-local --no-ci

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Bootstrapping 8 packages
lerna info Installing external dependencies
lerna ERR! 
lerna ERR! lerna EACCES: permission denied, rename '/home/joplin/packages/fork-htmlparser2/package.json' -> '/home/joplin/packages/fork-htmlparser2/package.json.lerna_backup'
+ rsync -r joplin/packages/server/package-lock.json joplin/packages/server/package.json ./packages/server/
+ npm run bootstrapServerOnly

> bootstrapServerOnly
> lerna bootstrap --force-local --no-ci --include-dependents --include-dependencies --scope @joplin/server

lerna notice cli v3.22.1
lerna info versioning independent
lerna notice filter including "@joplin/server"
lerna notice filter including dependents
lerna notice filter including dependencies
lerna info filter [ '@joplin/server' ]
lerna info Bootstrapping 9 packages
lerna info Installing external dependencies
lerna ERR! 
lerna ERR! lerna EACCES: permission denied, rename '/home/joplin/packages/fork-htmlparser2/package.json' -> '/home/joplin/packages/fork-htmlparser2/package.json.lerna_backup'
+ rsync -r joplin/packages/fork-sax/ ./packages/fork-sax/
+ rsync -r joplin/packages/htmlpack/ ./packages/htmlpack/
+ rsync -r joplin/packages/renderer/ ./packages/renderer/
+ rsync -r joplin/packages/tools/ ./packages/tools/
+ rsync -r joplin/packages/lib/ ./packages/lib/
+ rsync -r joplin/packages/server/ ./packages/server/
+ npm run build

> build
> lerna run build && npm run tsc

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Executing command in 4 packages: "npm run build"
lerna ERR! npm run build exited 127 in '@joplin/turndown-plugin-gfm'
lerna ERR! npm run build stdout:

> @joplin/turndown-plugin-gfm@1.0.42 build
> rollup -c config/rollup.config.cjs.js

lerna ERR! npm run build stderr:
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs'
}
sh: 1: rollup: not found

lerna ERR! npm run build exited 127 in '@joplin/turndown-plugin-gfm'
lerna WARN complete Waiting for 3 child processes to exit. CTRL-C to exit immediately.
bernd-wechner commented 2 years ago

And some experimentation and file system examination later, it works.

There is some bizarre thing going on in that npm drops root status quietly when it runs it seems, downgrades itself. Total novelty to me that. So if you run with sudo it no go. But sudo -u joplin and all good! Well worth documenting. I'll PR that soon.

$ sudo -u joplin bash -x joplin-build.sh 
+ cd /home/joplin
+ rm -f package-lock.json package.json
+ cp joplin/package-lock.json joplin/package.json ./
+ npm install --ignore-scripts

up to date, audited 1586 packages in 40s

90 packages are looking for funding
  run `npm fund` for details

69 vulnerabilities (31 moderate, 38 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
+ rm -rf packages
+ mkdir packages
+ rsync -r joplin/packages/fork-sax/package-lock.json joplin/packages/fork-sax/package.json ./packages/fork-sax/
+ rsync -r joplin/packages/htmlpack/package-lock.json joplin/packages/htmlpack/package.json ./packages/htmlpack/
+ rsync -r joplin/packages/renderer/package-lock.json joplin/packages/renderer/package.json ./packages/renderer/
+ rsync -r joplin/packages/tools/package-lock.json joplin/packages/tools/package.json ./packages/tools/
+ rsync -r joplin/packages/lib/package-lock.json joplin/packages/lib/package.json ./packages/lib/
+ rsync -r joplin/lerna.json .
+ rsync -r joplin/tsconfig.json .
+ rsync -r joplin/packages/turndown/ ./packages/turndown/
+ rsync -r joplin/packages/turndown-plugin-gfm/ ./packages/turndown-plugin-gfm/
+ rsync -r joplin/packages/fork-htmlparser2/ ./packages/fork-htmlparser2/
+ npm run bootstrap

> bootstrap
> lerna bootstrap --force-local --no-ci

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Bootstrapping 8 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @joplin/fork-htmlparser2@4.1.38~prepare: @joplin/fork-htmlparser2@4.1.38
lerna info lifecycle @joplin/turndown-plugin-gfm@1.0.42~prepare: @joplin/turndown-plugin-gfm@1.0.42
lerna info lifecycle @joplin/turndown@4.0.60~prepare: @joplin/turndown@4.0.60

> @joplin/fork-htmlparser2@4.1.38 prepare /home/joplin/packages/fork-htmlparser2
> npm run build

> @joplin/fork-htmlparser2@4.1.38 build
> tsc

> @joplin/turndown-plugin-gfm@1.0.42 prepare /home/joplin/packages/turndown-plugin-gfm
> npm run build

> @joplin/turndown-plugin-gfm@1.0.42 build
> rollup -c config/rollup.config.cjs.js

src/gfm.js → lib/turndown-plugin-gfm.cjs.js...
created lib/turndown-plugin-gfm.cjs.js in 64ms

> @joplin/turndown@4.0.60 prepare /home/joplin/packages/turndown
> npm run build

> @joplin/turndown@4.0.60 build
> rollup -c config/rollup.config.cjs.js

src/turndown.js → lib/turndown.cjs.js...
created lib/turndown.cjs.js in 314ms
lerna success Bootstrapped 8 packages
+ rsync -r joplin/packages/server/package-lock.json joplin/packages/server/package.json ./packages/server/
+ npm run bootstrapServerOnly

> bootstrapServerOnly
> lerna bootstrap --force-local --no-ci --include-dependents --include-dependencies --scope @joplin/server

lerna notice cli v3.22.1
lerna info versioning independent
lerna notice filter including "@joplin/server"
lerna notice filter including dependents
lerna notice filter including dependencies
lerna info filter [ '@joplin/server' ]
lerna info Bootstrapping 9 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @joplin/fork-htmlparser2@4.1.38~prepare: @joplin/fork-htmlparser2@4.1.38
lerna info lifecycle @joplin/turndown@4.0.60~prepare: @joplin/turndown@4.0.60
lerna info lifecycle @joplin/turndown-plugin-gfm@1.0.42~prepare: @joplin/turndown-plugin-gfm@1.0.42

> @joplin/fork-htmlparser2@4.1.38 prepare /home/joplin/packages/fork-htmlparser2
> npm run build

> @joplin/fork-htmlparser2@4.1.38 build
> tsc

> @joplin/turndown-plugin-gfm@1.0.42 prepare /home/joplin/packages/turndown-plugin-gfm
> npm run build

> @joplin/turndown-plugin-gfm@1.0.42 build
> rollup -c config/rollup.config.cjs.js

src/gfm.js → lib/turndown-plugin-gfm.cjs.js...
created lib/turndown-plugin-gfm.cjs.js in 63ms

> @joplin/turndown@4.0.60 prepare /home/joplin/packages/turndown
> npm run build

> @joplin/turndown@4.0.60 build
> rollup -c config/rollup.config.cjs.js

src/turndown.js → lib/turndown.cjs.js...
created lib/turndown.cjs.js in 314ms
lerna success Bootstrapped 9 packages
+ rsync -r joplin/packages/fork-sax/ ./packages/fork-sax/
+ rsync -r joplin/packages/htmlpack/ ./packages/htmlpack/
+ rsync -r joplin/packages/renderer/ ./packages/renderer/
+ rsync -r joplin/packages/tools/ ./packages/tools/
+ rsync -r joplin/packages/lib/ ./packages/lib/
+ rsync -r joplin/packages/server/ ./packages/server/
+ npm run build

> build
> lerna run build && npm run tsc

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Executing command in 4 packages: "npm run build"
lerna info run Ran npm script 'build' in '@joplin/turndown-plugin-gfm' in 1.1s:

> @joplin/turndown-plugin-gfm@1.0.42 build
> rollup -c config/rollup.config.cjs.js

lerna info run Ran npm script 'build' in '@joplin/server' in 1.5s:

> @joplin/server@2.6.14 build
> gulp build

[20:04:37] Using gulpfile ~/packages/server/gulpfile.js
[20:04:37] Starting 'build'...
[20:04:37] Starting 'compilePackageInfo'...
Warning: Could not get git info (it will not be displayed in About dialog box)
Generated /home/joplin/packages/server/dist/packageInfo.js
[20:04:37] Finished 'compilePackageInfo' after 40 ms
[20:04:37] Finished 'build' after 44 ms
lerna info run Ran npm script 'build' in '@joplin/turndown' in 1.8s:

> @joplin/turndown@4.0.60 build
> rollup -c config/rollup.config.cjs.js

lerna info run Ran npm script 'build' in '@joplin/fork-htmlparser2' in 10.2s:

> @joplin/fork-htmlparser2@4.1.38 build
> tsc

lerna success run Ran npm script 'build' in 4 packages in 10.3s:
lerna success - @joplin/fork-htmlparser2
lerna success - @joplin/server
lerna success - @joplin/turndown-plugin-gfm
lerna success - @joplin/turndown

> tsc
> lerna run tsc --stream --parallel

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Executing command in 5 packages: "npm run tsc"
@joplin/tools: > @joplin/tools@2.6.2 tsc
@joplin/tools: > tsc --project tsconfig.json
@joplin/lib: > @joplin/lib@2.6.2 tsc
@joplin/lib: > node node_modules/typescript/bin/tsc --project tsconfig.json
@joplin/renderer: > @joplin/renderer@2.6.2 tsc
@joplin/renderer: > node node_modules/typescript/bin/tsc --project tsconfig.json
@joplin/server: > @joplin/server@2.6.14 tsc
@joplin/server: > tsc --project tsconfig.json
@joplin/htmlpack: > @joplin/htmlpack@2.6.0 tsc
@joplin/htmlpack: > tsc --project tsconfig.json
lerna success run Ran npm script 'tsc' in 5 packages in 28.8s:
lerna success - @joplin/htmlpack
lerna success - @joplin/lib
lerna success - @joplin/renderer
lerna success - @joplin/server
lerna success - @joplin/tools
bernd-wechner commented 2 years ago

Fixed by https://github.com/hi-ko/joplin-server-ubuntu-install/pull/3