You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: nodejs-java/getting-started/installation.md
+166-5Lines changed: 166 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,172 @@ hideChildren: False
11
11
toc: True
12
12
---
13
13
14
-
## Install using NPM
14
+
Welcome to the installation guide for the GroupDocs.Viewer package! This guide will help you set up the package for your Node.js application.
15
15
16
-
All Java packages are hosted at [NPM](https://www.npmjs.com/package/@groupdocs/groupdocs.viewer). You can easily reference GroupDocs.Viewer for Node.js via Java API directly in your Node.js project by installing it with the following command.
16
+
Before you begin, please ensure that your system meets the necessary requirements. You can find detailed information about the system requirements at [System Requirements](/viewer/nodejs-java/system-requirements/).
17
17
18
-
```batch
19
-
npm install @groupdocs/groupdocs.viewer
20
-
```
18
+
In this guide, you will find step-by-step instructions for installing the package via npm, adding it manually, and troubleshooting common installation issues. Let’s get started!
21
19
20
+
### NPM installation
21
+
22
+
To install the GroupDocs.Viewer package using NPM, follow these steps:
23
+
24
+
1.**Open a Terminal**
25
+
Make sure you are in your project directory where you want to install the package.
26
+
27
+
2.**Run the following command** to install the GroupDocs.Viewer package:
28
+
29
+
```bash
30
+
npm install @groupdocs/groupdocs.viewer
31
+
```
32
+
33
+
{{< alert style="tip" >}}
34
+
In case you're using NPM version lower than 5 add `--save` switch. You can check NPM version by typing `npm -v` in your terminal.
35
+
{{< /alert >}}
36
+
37
+
3.**Expected Console Output**
38
+
Once you run the command, you should see output similar to the following:
39
+
40
+
```bash
41
+
added 109 packages, and audited 110 packages in 2m
42
+
43
+
14 packages are looking for funding
44
+
run `npm fund`for details
45
+
46
+
found 0 vulnerabilities
47
+
```
48
+
49
+
This confirms that the package was installed successfully. The package version number and other details in the output may vary depending on your environment.
50
+
51
+
4.**Verify Installation**
52
+
You can verify the installation by checking the `package.json` file in your project directory. You should see `groupdocs-viewer` listed under dependencies:
You can now proceed to using the package in your JavaScript code. If you prefer to install the package manually or need further details, check the next sections.
64
+
65
+
### Adding the package manually
66
+
67
+
In cases where you prefer to add the `@groupdocs/groupdocs.viewer` package manually, follow these steps:
68
+
69
+
1.**Open the `package.json` file** located in your project’s root directory.
70
+
71
+
2.**Add the GroupDocs.Viewer dependency** in the `dependencies` section, as shown below:
{{< alert style="tip" >}} You can find actual `@groupdocs/groupdocs.viewer` package version at [the package page](https://www.npmjs.com/package/@groupdocs/groupdocs.viewer) on NPM.{{< /alert >}}
82
+
83
+
3.**Save the `package.json` file**.
84
+
85
+
4.**Install the dependencies** by running the following command:
86
+
87
+
```bash
88
+
npm install
89
+
```
90
+
91
+
This will install the GroupDocs.Viewer package based on the version specified in your `package.json` file.
92
+
93
+
### Minimal JavaScript app example
94
+
95
+
Once you have installed the GroupDocs.Viewer package, here’s a minimal example of how you can use it in a Node.js application.
96
+
97
+
1.**Create a JavaScript file** (e.g., `app.js`) in your project’s root directory.
98
+
99
+
2.**Import the GroupDocs.Viewer module** and implement a simple file viewing functionality:
The [sample-app.zip](/viewer/nodejs-java/sample-files/getting-started/installation/sample-app.zip) is a sample Node.js application that you can download to get started.
122
+
{{< /tab-text >}}
123
+
{{< /tab >}}
124
+
{{< /tabs >}}
125
+
126
+
3.**Run the app** by executing the following command in your terminal:
127
+
128
+
```bash
129
+
node app.js
130
+
```
131
+
132
+
This minimal example converts a document to HTML format. The output will contain rendered pages in HTML format.
133
+
134
+
### Additional tips
135
+
136
+
Here are some troubleshooting tips for common installation issues you may encounter while setting up the GroupDocs.Viewer package:
137
+
138
+
1.**Ensure Node.js is Installed**
139
+
- Verify that you have Node.js installed on your machine. You can check the installation by running the following command:
140
+
```
141
+
node -v
142
+
```
143
+
- If Node.js is not installed, download and install it from the [official Node.js website](https://nodejs.org/).
144
+
145
+
2. **Ensure Java is Installed**
146
+
- GroupDocs.Viewer may require Java for certain functionalities. Verify that Java is installed on your machine by running:
147
+
```
148
+
java -version
149
+
```
150
+
- If Java is not installed, download and install it from the [official Oracle website](https://www.oracle.com/java/technologies/downloads/) or [OpenJDK](https://openjdk.org/) or [Microsoft Build of OpenJDK](https://www.microsoft.com/openjdk).
151
+
152
+
3. **Check npm Version**
153
+
- Ensure you are using a compatible version of npm. You can check your npm version by running:
154
+
```
155
+
npm -v
156
+
```
157
+
- If you have an outdated version, consider updating it:
158
+
```
159
+
npm install -g npm@latest
160
+
```
161
+
162
+
4. **Clear npm Cache**
163
+
- Sometimes, corrupted cache can cause installation issues. You can clear the npm cache by running:
164
+
```
165
+
npm cache clean --force
166
+
```
167
+
168
+
5. **Verify Dependency Installation**
169
+
- If you encounter issues related to dependencies not being installed, ensure that your `package.json` file is correctly configured. You can manually add the `groupdocs-viewer` entry in the `dependencies` section and then run:
170
+
```
171
+
npm install
172
+
```
173
+
174
+
6. **Check for Permission Issues**
175
+
- If you encounter permission errors during installation, try running the command with elevated privileges:
176
+
```
177
+
sudo npm install @groupdocs/groupdocs.viewer
178
+
```
179
+
- Alternatively, consider setting up a Node version manager like [nvm](https://github.com/nvm-sh/nvm) to avoid permission issues with global installations.
180
+
181
+
7. **Reach Out for Support**
182
+
- If you continue to experience issues, consider reaching out our [Free Support Forum](https://forum.groupdocs.com/c/viewer/9) for assistance.
0 commit comments