? A workaround that Npmlog cannot find in NPM in Linux
Describe
Today, when a server migration to the NODEJS project is performed, the NPM-V command is entered on the new Linux server and the error "Cannot find module ' npmlog ' ..." is reported. The reason for this is that the copy of the past bin directorynpm
File is not linked to the module directorynpm-cli.js
File, so results in executingnpm -v
command, the path problem causesnpmlog
Module could not be found.
Workaround
There are two workarounds, one is to delete the NPM file under the Bin directory and link to it with the following command npm-cli.js
.
1 |
ln -s .. /lib/node_modules/npm/bin/npm-cli.js |
After the experiment found, in the server decompression NODEJS official website downloaded compiled compressed package, and then copy the extracted files to the server, the bin npm
is not linked to npm-cli.js
.
The second way is to download the goodnode-v0.10.33-linux-x64.tar.gz
The compressed package is first placed on the server and then decompressed, at which pointnpm
is already linked tonpm-cli.js
Of
See the command line as shown below for success.
12345 |
[[email protected] bin]# llNPM-. /lib/node_modules/npm/bin/npm-cli.js[[email protected] bin]#./npm-vV1.4.26 |
The reasons for these two copies of the different circumstances are unknown and need to be studied.
Article Foreverpx
Article source link: In Linux, NPM appeared npmlog found a workaround
A workaround that Npmlog cannot find in NPM in Linux