問題一:
yarn : 無法加載文件 D:\jsPackage\nodejs\node_global\yarn.ps1,因為在此系統上禁止運行腳本。
解決:
步驟1,powerShell以管理員運行后,輸入命令:
get-ExecutionPolicy 查看權限, 會看到它的返回值是 Restricted , 意思是 當前是禁用的。
步驟2, 在窗口上執行:
set-ExecutionPolicy RemoteSigned,然后輸入Y,按Enter確認.
步驟3, 查看執行策略:get-ExecutionPolicy,看到它的返回值是 RemoteSigned
問題二:
?npm ERR! ERESOLVE could not resolve。npm install 裝包報錯重新裝包;
解決:依賴重裝
npm i --legacy-peer-deps
問題三:
npm install報錯 -> npm ERR! Unexpected token ‘.‘ 報錯解決辦法。
解決:
由于低版本nvm不能適用控制高版本node,需要先卸載各node版本,再卸載nvm,再安裝最新版本nvm。
問題四:
msvs_version was set from command line or npm config
Please restart this script from an administrative PowerShell!
npm ERR! The build tools cannot be installed without administrative rights.
解決: 用管理員身份打開 ?PowerShell 運行命令
問題五:
verbose audit error HttpErrorGeneral: 404 Not Found - POST https://registry.npmmirror.com/-/npm/v1/security/audits/quick
解決:
意思是說鏡像獲取不到,輸入命令 npm config get registry,查看當前npm鏡像源,是taobao的,
切換回默認的試試看。npm config delete registry?
問題六:
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python\Python3.7.3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
node.js與系統的python版本沖突 我的是Py3.7
解決:npm config set python python2.7
問題七:
yarn
error commander@9.2.0: The engine “node” is incompatible with this module. Expected version “^12.20.0 || >=14”. Got “12.13.0” error Found incompatible module.
解決:
Yarn創建Vue項目,出現node版本不兼容問題。 執行: yarn config set ignore-engines true
問題八:
yarn add 報
error Missing list of packages to add to your project. info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
解決:
yarn add --save lodash 安裝就會報這個錯
改成這樣:yarn add lodash --save
因為yarn add后面必須跟包名。
問題九:
These dependencies were not found:
* core-js/modules/es.array.push.js in ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js, ./src/main.js and 58 others
解決:
用于繞過peerDependency里依賴的自動安裝,依賴對等.
npm i --legacy-peer-deps