Bug解决Jupyter lab安装插件:ValueError: “xxx“ is not a valid npm package

Posted zstar-_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Bug解决Jupyter lab安装插件:ValueError: “xxx“ is not a valid npm package相关的知识,希望对你有一定的参考价值。

问题描述

下载完Jupyter lab环境,想安装一些插件,于是需要先安装nodejs和npm。
于是进行安装

pip install npm
pip install nodejs

但是安装完后,再install插件,结果报错。

ValueError: "@ryantam626/jupyterlab_code_formatter" is not a valid npm package

报错目录日志内容:

Node v17.9.0

Yarn configuration loaded.
> D:\\Anaconda\\npm.CMD pack @ryantam626/jupyterlab_code_formatter
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\\nodejs\\node_cache\\_cacache\\index-v5\\f5\\2f
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\\nodejs\\node_cache\\_cacache\\index-v5\\f5\\2f'
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'D:\\nodejs\\node_cache\\_cacache\\index-v5\\f5\\2f'] 
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'D:\\\\nodejs\\\\node_cache\\\\_cacache\\\\index-v5\\\\f5\\\\2f'
npm ERR! 
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:

Traceback (most recent call last):

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\debuglog.py", line 47, in debug_logging
    yield

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\labextensions.py", line 144, in start
    ans = self.run_task()

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\labextensions.py", line 191, in run_task
    [

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\labextensions.py", line 192, in <listcomp>
    install_extension(

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\commands.py", line 421, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\commands.py", line 645, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\commands.py", line 1710, in _install_extension
    info = self._extract_package(extension, tempdir, pin=pin)

  File "d:\\anaconda\\lib\\site-packages\\jupyterlab\\commands.py", line 1783, in _extract_package
    raise ValueError(msg % source)

ValueError: "@ryantam626/jupyterlab_code_formatter" is not a valid npm package

Exiting application: lab

解决方式

找了许久在这篇文章npm ERR! code: ‘EPERM’ (权限问题 errro permit)中找到解决办法。
进入C:\\Users\\账户名\\
删除该目录下的.npmrc文件即可
之后再通过命令安装插件,可以看到插件被成功安装。

好用的插件推荐

这篇博客jupyterlab 插件推荐提供了一些比较实用的插件和下载配置方法。
截止此文撰写时,除了jupyterlab-variableInspector这个插件外,其它均可正常安装。
jupyterlab-variableInspector安装失败,原作者的github上有人给出了解决方法。
下载本地vi.tar.gz文件,使用pip install vi.tar.gz安装即可。
该文件我也上传到了我的资源内,有需要的可以下载。
地址:https://download.csdn.net/download/qq1198768105/85118023

以上是关于Bug解决Jupyter lab安装插件:ValueError: “xxx“ is not a valid npm package的主要内容,如果未能解决你的问题,请参考以下文章

超赞!十大Jupyter Lab必备插件!Jupyter必备神器!

jupyter lab最强代码补全插件

jupyter lab 中编辑 .md文件

Jupyter Lab 十大高生产力插件

这款拓展让你的jupyter lab使用更高效

jupyter lab 安装