公司代理环境下Ionic创建应用卡在npm i步骤求助
Hey there! It sounds like you're hitting a common roadblock when working with npm behind a company proxy—let's walk through how to fix this stuck npm i step when creating your first Ionic app.
First, address the most likely culprit: Proxy configuration
Corporate proxies often block npm's access to the public registry, so we need to make sure npm is set up to use your company's proxy correctly.
Set npm proxy settings
Run these commands in your terminal, replacingyour-proxy-address:portwith your actual company proxy details (addusername:password@before the address if your proxy requires authentication):npm config set proxy http://your-proxy-address:port npm config set https-proxy http://your-proxy-address:portVerify the npm registry
Make sure npm is pointing to the correct public registry (sometimes proxies or previous configs can alter this):npm config get registryIf it's not
https://registry.npmjs.org/, reset it with:npm config set registry https://registry.npmjs.org/
Next, clear npm cache and reset dependencies
Stale cache or corrupted partial installs can cause hangs too:
- Force clear the npm cache:
npm cache clean --force - Navigate to your
hello_ionicproject folder, delete thenode_modulesfolder andpackage-lock.jsonfile (if they exist). - Try running
npm installagain manually.
Additional fixes to try
Update Ionic and npm
Outdated versions can have compatibility issues with proxies. Update both to the latest versions:npm install -g @ionic/cli npm install -g npm@latestDisable strict SSL temporarily
Some corporate proxies use self-signed certificates that npm rejects. You can turn off strict SSL checking (note: this is a temporary workaround—ask your IT team for the correct certificate to install long-term):npm config set strict-ssl falseCreate the project without auto-installing dependencies
If theionic startcommand still hangs duringnpm i, create the project first and install dependencies manually:ionic start hello_ionic tabs --no-depsThen navigate into the project folder, set up your proxy config as above, and run
npm install.
A note on your npm info output
Looking at the npm info output you shared, the package details seem a bit unusual (e.g., the tarball points to appapp-1.0.0.tgz instead of an Ionic-related package). This suggests that npm might be pulling the wrong package due to proxy/registry issues—fixing the proxy config should resolve this mismatch.
内容的提问来源于stack exchange,提问作者bhanuprakash reddy

