daisy / daisy/ace

Installation as super-user fails, after workaround logging directory is missing

Open
#361 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
98
Forks
29
PR merge metrics
No merged PRs in 30d

Description

As per the [documentation](https://daisy.github.io/ace/getting-started/installation/), I installed Ace using (using sudo because earlier attempt at installing with default permissions failed):

```
sudo npm install @daisy/ace -g -unsafe-perm=true --allow-root
```
This resulted in:

```
sudo: npm: command not found
```

Which is strange, because npm works without sudo. A quick Google search on the error message led me [here](https://stackoverflow.com/questions/31472755/sudo-npm-command-not-found). I didn't want to mess with file permissions (which is one of the most popular suggestions in that thread), so instead I followed [this suggestion](https://stackoverflow.com/a/44704646/1209004). First I queried the location of npm using:

```
which npm
```

Result:

```
/home/johan/.nvm/versions/node/v10.11.0/bin/npm
```

I then created a symbolic link to this in `/usr/bin`:

```
sudo ln -s /home/johan/.nvm/versions/node/v10.11.0/bin/npm /usr/bin/npm
```

After this change I was able to run the install command without errors. However, after installation, running Ace on an EPUB now failed with the following error message:

```
(node:6038) ExperimentalWarning: The fs.promises API is experimental
Error: ENOENT: no such file or directory, mkdir '/home/johan/.local/state/DAISY Ace'
at Object.mkdirSync (fs.js:731:3)
at File._createLogDirIfNotExist (/usr/lib/node_modules/@daisy/ace/node_modules/winston/lib/winston/transports/file.js:691:10)
at new File (/usr/lib/node_modules/@daisy/ace/node_modules/winston/lib/winston/transports/file.js:92:28)
at Object.initLogger (/usr/lib/node_modules/@daisy/ace/node_modules/@daisy/ace-logger/lib/index.js:111:25)
at Object.run (/usr/lib/node_modules/@daisy/ace/node_modules/@daisy/ace-cli-shared/lib/index.js:98:10)
at Object.run (/usr/lib/node_modules/@daisy/ace/node_modules/@daisy/ace-cli/lib/index.js:7:13)
at /usr/lib/node_modules/@daisy/ace/node_modules/@daisy/ace-cli/bin/ace.js:4:29
at Object. (/usr/lib/node_modules/@daisy/ace/node_modules/@daisy/ace-cli/bin/ace.js:5:3)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
```

A quick look my '/home/johan/.local/' directory showed that it didn't contain the 'state/DAISY Ace' subdirectories. After creating these directories manually Ace now works as expected.

I have no idea if the missing logging directory is a secondary effect of the symbolic link workaround I used to fix the npm issue, or some (unrelated) bug in Ace. In any case, since the problem with running npm with sudo permissions seems to be widespread, perhaps it would be helpful to add this information to the [Troubleshooting page](https://daisy.github.io/ace/help/troubleshooting/)?

- Ace v. 1.2.5
- Node v10.11.0
- Operating system: Linux Mint 20.1 Ulyssa

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.