Yesterday I successfully build onos 2.7.0 , but when I try to implement the same procedures today on another machine I got stuck with the npm issues. I remember I had the same problem yesterday, I was able to solve it by reinstall npm, but iI won't work today.
First, I tried to use 'which npm" and remove all relevant files by using
sudo apt-get remove --purge npm
sudo apt-get remove --purge
nodejs
sudo apt-get remove --purge
nodejs-legacy
sudo apt-get autoremove
Second, I turned off my proxy settings so my machine could directly access the internet.
And the following errors keeps the same.
leo@leo-virtual-machine:~/Documents/1.Shiwen/onos$ bazel build onos
Starting local Bazel server and connecting to it...
INFO: Repository gui1_npm instantiated at:
/home/leo/Documents/1.Shiwen/onos/WORKSPACE:180:12: in <toplevel>
/home/leo/.cache/bazel/_bazel_leo/71824e2fdfb08800df3353711da34136/external/build_bazel_rules_nodejs/index.bzl:84:17: in npm_install
Repository rule npm_install defined at:
/home/leo/.cache/bazel/_bazel_leo/71824e2fdfb08800df3353711da34136/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl:300:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'gui1_npm':
Traceback (most recent call last):
File "/home/leo/.cache/bazel/_bazel_leo/71824e2fdfb08800df3353711da34136/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 281, column 13, in _npm_install_impl
fail("npm_install failed: %s (%s)" % (result.stdout, result.stderr))
Error in fail: npm_install failed: (Unhandled rejection Error: EACCES: permission denied, mkdir '/home/leo/.npm/_cacache/content-v2/sha512/47/8e'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/leo/.npm/_cacache/content-v2/sha512/47/8c'
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/leo/.npm/_logs/2022-03-04T18_44_25_098Z-debug.log
)
ERROR: /home/leo/Documents/1.Shiwen/onos/web/gui/BUILD:98:8: //web/gui:_onos-gui-npm-install depends on @gui1_npm//:node_modules in repository @gui1_npm which failed to fetch. no such package '@gui1_npm//': npm_install failed: (Unhandled rejection Error: EACCES: permission denied, mkdir '/home/leo/.npm/_cacache/content-v2/sha512/47/8e'
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/leo/.npm/_cacache/content-v2/sha512/47/8c'
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/leo/.npm/_logs/2022-03-04T18_44_25_098Z-debug.log
)
ERROR: Analysis of target '//:onos' failed; build aborted: Analysis failed
INFO: Elapsed time: 23.092s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (979 packages loaded, 24352 target\
s configured)