apidoc: Unable to load file C:\Users\ *\AppData\Roaming\npm\apid oc.ps1 because running scripts and executing Set-ExecutionPolic failed on this system. Resolution

Foreword:

Recently when I was learning node.js, I encountered some problems when using apidoc to generate api documents. The first step is to install

apidoc, the command is as follows

npm install apidoc -g

However, after executing the command

1.apdoc -h 

2. Generate the project root directory, one level up

apidoc -i otc-audit-end/application -o otc-audit-end/public

When, the terminal reports an error

 apidoc: Unable to load file C:\Users\Yue Jingjing\AppData\Roaming\npm\apid oc.ps1 because running scripts is prohibited on this system. For more information, see about_Execution_Policies at http s:/go.microsoft.com/fwlink/?Lin kID=135170.

 The reason is because the script is prohibited from running on this system,

Solution:

1. Open the terminal as administrator - right click on the start menu (win icon)

 2. Execute set-ExecutionPolicy RemoteSigned (sign or run these scripts)

set-ExecutionPolicy RemoteSigned

Some computers can be set up successfully directly, but some will be marked in red and require further operations, for example, as shown in the figure below

 We can enter commands according to the prompts

 Get-ExecutionPolicy -List

after,

 Can execute commands

Set-ExecutionPolicy -Scope CurrentUser

Then we will be prompted to enter. We enter the RemoteSigned we just entered.

 That's solved

verify:

Open vscode and enter  apidoc -h to view,

 No error is reported, enter again

The corresponding file is generated under the hehe folder, ok, the problem is solved successfully~ 

Supongo que te gusta

Origin blog.csdn.net/www340300/article/details/131598178
Recomendado
Clasificación