Added diagnosis npm install

Hugo Bernier 2022-03-27 00:12:21 -04:00
parent fa0be55b00
commit e5aac1942a
1 changed files with 15 additions and 1 deletions

@ -25,13 +25,27 @@ graph TD
style H fill:#f9f,stroke:#333,stroke-width:4px
style K fill:#f9f,stroke:#333,stroke-width:4px
style J fill:#f9f,stroke:#333,stroke-width:4px
style B font-family:monospace
```
## Diagnose `npm install` issues
Please note that warnings will rarely prevent the solution from working; We only worry about errors.
```mermaid
graph TD
A[Run npm install]
A --> B{Errors?}
B --> |Yes| C{Are you in root of project?} --> |No| D[Change directory] --> |Retry|A
B --> |No| E{Running on Windows?}
E --> |Yes| F{Path too long?} --> |Yes| H[Move project to shorter path] --> |Retry|A
E --> |No| K[Run spfx doctor]
K --> J{Any reported issues?} --> |Yes| L[Fix issuen] --> |Retry|A
K --> |No| M{Did you change versions of nodejs after downloading sample?} --> |Yes| N[Run npm rebuild node-sass] --> |Retry|A
M --> |No| O[Open a ticket from sample's README]
click K "https://github.com/pnp/sp-dev-fx-webparts/wiki/Troubleshooting-issues-with-samples#run-spfx-doctor"
style K fill:#f9f,stroke:#333,stroke-width:4px
```
### `npm WARN saveError ENOENT: no such file or directory`
Make sure that you are running `npm install` in the root folder where the web part code is located. There should be an existing `package.json` file. **Do not** create a `package.json`, because the solution must already have one -- otherwise it would not have been accepted as a sample.