我正在运行 Ubuntu 18.04。我已经安装了 nodejs,但我想我可能在某个地方搞砸了。我正尝试使用 启动一个 ionic 应用程序ionic serve --devappcd
。然后我收到此错误消息:
ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[INFO] Looks like @ionic/app-scripts isn't installed in this project.
This package is required for this command to work properly.
The package provides a CLI utility, but the ionic-app-scripts binary was not found in your PATH.
? Install @ionic/app-scripts? Yes
npm i -D -E @ionic/app-scripts
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/4f/4a'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/a5/ef'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/4f/c4'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/6e/d0'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/1e/e1'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/74/2e'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/mick/.npm/_cacache/index-v5/68/37'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mick/.npm/_logs/2019-04-06T12_04_23_552Z-debug.log
[ERROR] An error occurred while running subprocess npm.
npm i -D -E @ionic/app-scripts exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
是否可以卸载nodejs并重新启动?
答案1
使用此命令:
sudo npm cache clean --force --unsafe-perm
然后重复该过程。
答案2
您没有对全局包的适当权限访问。
彻底卸载 node js
安装节点(我更喜欢 snap)
sudo snap 安装节点 --channel=10/stable --classic
跟随本指南为您的全局包授予正确的权限。步骤如下
cd
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
nano .profile
# add at the end of .profile file
export PATH=~/.npm-global/bin:$PATH
# save, then reload by running.
source ~/.profile
现在你应该安装 ionic cli(不要使用 sudo) 并尝试运行该项目。