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

2022-06-14 14:57:00 浏览数 (1)

问题描述

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

代码语言:javascript复制
pip install npm
pip install nodejs

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

代码语言:javascript复制
ValueError: "@ryantam626/jupyterlab_code_formatter" is not a valid npm package

报错目录日志内容:

代码语言:javascript复制
Node v17.9.0

Yarn configuration loaded.
> D:Anacondanpm.CMD pack @ryantam626/jupyterlab_code_formatter
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:nodejsnode_cache_cacacheindex-v5f52f
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:nodejsnode_cache_cacacheindex-v5f52f'
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'D:nodejsnode_cache_cacacheindex-v5f52f'] {
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:anacondalibsite-packagesjupyterlabdebuglog.py", line 47, in debug_logging
    yield

  File "d:anacondalibsite-packagesjupyterlablabextensions.py", line 144, in start
    ans = self.run_task()

  File "d:anacondalibsite-packagesjupyterlablabextensions.py", line 191, in run_task
    [

  File "d:anacondalibsite-packagesjupyterlablabextensions.py", line 192, in <listcomp>
    install_extension(

  File "d:anacondalibsite-packagesjupyterlabcommands.py", line 421, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "d:anacondalibsite-packagesjupyterlabcommands.py", line 645, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "d:anacondalibsite-packagesjupyterlabcommands.py", line 1710, in _install_extension
    info = self._extract_package(extension, tempdir, pin=pin)

  File "d:anacondalibsite-packagesjupyterlabcommands.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

0 人点赞