我格式化了imac并删除了HD上的所有文件。但是,当我安装angular cli 7时,终端控制台显示此错误日志。
macOS:Mojave 10.14.2 节点:v10.15 npm:6.4.1
miguels-imac:~ makito$ sudo npm install -g @angular/cli
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
> fsevents@1.2.7 install
/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
> node install
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.7
and node@10.15.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/build'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.15.0/bin/node" "/usr/local/Cellar/node@10/10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node@10/10.15.0/bin/node /usr/local/Cellar/node@10/10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node@10/10.15.0/bin/node" "/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node@10/10.15.0/bin/node /usr/local/Cellar/node@10/10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ @angular/cli@7.2.3
added 294 packages from 178 contributors in 20.637s
如果我显示了全局依赖关系,那么我有@ angular / cli ...那么,为什么会出现此错误?,我在做什么错呢?。
在stackOverflow上搜索,我决定安装node-pre-gyp
,然后安装xCode。但是,什么都没有改变。
答案 0 :(得分:8)
我做到了,它对我有用。
将以下行添加到您的〜/ .bash_profile中 (导出PATH =“ $ HOME / .npm-packages / bin:$ PATH”)
卸载当前的@ angular / cli(sudo npm卸载-g @ angular / cli)
让我知道它是否有效
答案 1 :(得分:3)
您没有做任何错,与(可能)fsevents有关的一些错误,node.js的官方软件包(lts和current)和自制软件安装都存在此问题。
在该线程上关注答案:How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
[基本上,您需要手动删除节点,npm,ng文件和文件夹]
并安装nvm,然后安装nvm。
答案 2 :(得分:0)
我尝试了上述修复程序,但遇到了同样的问题。 我认为尽管有警告和错误,但CLI仍应正确安装。
我运行了ng v
,可以看到已安装新版本。
这里已经记录了类似的问题 https://github.com/aws-amplify/amplify-cli/issues/783