win10安裝node-red遇到的問題及解決方法


1.安裝失敗

原因:沒有管理員權限,需要用powershell(管理員)來安裝

2.安裝完成后運行失敗

出現下面的情況

PS C:\WINDOWS\system32> node-red
node-red : 無法加載文件 C:\Users\Administrator\AppData\Roaming\npm\node-red.ps1,因為在此系統上禁止運行腳本。
有關詳細信息,請參閱 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ node-red
+ ~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

原因:win10默認策略會禁止運行腳本

方法:如下,使用set-ExecutionPolicy RemoteSigned命令,改變腳本運行策略
PS C:\WINDOWS\system32> set-ExecutionPolicy RemoteSigned

執行策略更改
執行策略可幫助你防止執行不信任的腳本。更改執行策略可能會產生安全風險,如
https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies 幫助主題所述。是否要更改執行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暫停(S) [?] 幫助 (默認值為“N”): y

 

 

3.安裝串口節點失敗

 

出現下面情況

18 Oct 16:46:37 - [info] 安裝模塊:node-red-node-serialport,版本:0.14.1

18 Oct 16:47:07 - [warn] 模塊node-red-node-serialport安裝失敗:
18 Oct 16:47:07 - [warn] ------------------------------------------
18 Oct 16:47:07 - [warn] prebuild-install WARN install read ECONNRESET
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
。。。

原因:缺乏對應環境

方法:在PowerShell中輸入以下命令:npm install --global --production windows-build-tools@4.0.0,等候一會,安裝好對應環境之后,再安裝其他節點就沒有再報錯了。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM