Windows环境Jupyter Notebook无法访问npm和node(暂未解决)

news/2024/10/18 21:08:23

Windows环境Jupyter Notebook无法访问npm和node

content

The issue may arise from using Node.js and npm through NVM (Node Version Manager), which installs them in user-specific directories. While this setup works, Jupyter Notebook or Conda might not correctly detect the npm and node binaries due to path resolution issues on Windows.

Troubleshooting Steps

  1. Check if the PATH is set correctly for npm and node:
    Your output shows:

    C:\Users\11543\AppData\Roaming\nvm\v20.18.0\npm
    C:\Users\11543\AppData\Roaming\nvm\v20.18.0\npm.cmd
    C:\Users\11543\AppData\Roaming\nvm\v20.18.0\node.exe
    

    Ensure these paths are correctly added to your Windows PATH:

    • Open Control Panel → System → Advanced system settings → Environment Variables.
    • Under User variables or System variables, find the Path variable and ensure the following paths are included:
      C:\Users\11543\AppData\Roaming\nvm\v20.18.0\
      C:\Users\11543\AppData\Roaming\nvm\
      
  2. Set npm and Node.js in Conda's environment:
    Conda may not recognize the Node.js installed by NVM. To ensure compatibility, try explicitly setting the paths within the Conda environment.

    • Activate your Conda environment:

      conda activate base  # Or your specific environment
      
    • Set the Node.js path manually for that session:

      set PATH=C:\Users\11543\AppData\Roaming\nvm\v20.18.0;%PATH%
      

    Alternatively, you can install Node.js via Conda to avoid the path conflict:

    conda install -c conda-forge nodejs
    
  3. Ensure npm works within Jupyter:
    Open a Jupyter notebook and try executing the following code to check if npm is correctly detected:

    !npm -v
    !node -v
    

    If it still fails, try starting Jupyter with a modified path:

    set PATH=C:\Users\11543\AppData\Roaming\nvm\v20.18.0;%PATH% && jupyter notebook
    
  4. Verify and Clean npm Configuration:
    Sometimes, npm misconfigures itself when installed via multiple sources. Run:

    npm config delete prefix
    npm cache clean --force
    
  5. Rebuild Jupyter Extensions (if applicable):
    If you're using JupyterLab extensions:

    jupyter lab build
    

Conclusion

The problem likely lies in Conda or Jupyter not detecting the npm installed through NVM due to path configuration issues. Adding the correct paths to your environment variables or installing Node.js via Conda should resolve the issue.

尝试了以上方法,但是暂未解决该问题;无论是用pip还是conda安装的版本,均面临此问题;不过该问题目前暂未对日常使用造成影响,因为还未安装任何扩展。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.ryyt.cn/news/73215.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈,一经查实,立即删除!

相关文章

正点原子新起点V2开发板FPGA关于SDRAM代码解读

正点原子新起点V2开发板FPGA关于SDRAM代码解读 1. SDRAM 概述 SDRAM(Synchronous Dynamic Random Access Memory)是一种同步动态随机存储器,广泛用于FPGA项目中。通过SDRAM控制模块,可以实现数据读写、刷新等操作。本文对SDRAM的控制模块进行详细解读,分析代码中的命令控制…

面试题速刷 - 实战会碰到的一些问题

页面如何进行首屏优化?路由懒加载服务端渲染SSR只获取HTML就可以,里面包含data。 APP预取(啥东西)APP结合H5、结合JS bridge 分页图片懒加载 lazyloadHybrid总结:后端一次性返回10w条数据,你会如何渲染? 本身后端设计方案的设计就不合理!非要的话......自定义中间层:虚…

氏发

这个作业属于哪个课程 2024高级语言程序设计 (福州大学 - 计算机与大数据学院)这个作业要求在哪里 高级语言程序设计课程第三次个人作业学号 102400117姓名 廖逸轩

二、STM32F103C8T6-定时器

STM32F103C8T6 定时器概述 STM32F103C8T6 作为一款广泛使用的微控制器,内置多个定时器,能够支持多种计时和控制功能,如精确延时、脉冲宽度调制(PWM)、捕获比较(Capture/Compare)、输入捕获 和 输出比较 等。这些功能在电机控制、信号测量、周期性事件触发等应用中非常常…

Sparse Table

Sparse Table 可用于解决这样的问题:给出一个 \(n\) 个元素的数组 \(a_1, a_2, \cdots, a_n\),支持查询操作计算区间 \([l,r]\) 的最小值(或最大值)。这种问题被称为区间最值查询问题(Range Minimum/Maximum Query,简称 RMQ 问题)。预处理的时间复杂度为 \(O(n \log n)\…

MinIO

1.概述一个开源的用于存储文件的分布式文件存储系统2.官网http://docs.minio.org.cn/docs/3.相关概念bucket – 类比于文件系统的目录 Object – 类比文件系统的文件 Keys – 类比文件名4.搭建 docker run -p 9000:9000 --name minio -d --restart=always -e "MINIO_ACCES…

计量经济学(十一)——联立方程模型的估计

img { display: block; margin-left: auto; margin-right: auto } table { margin-left: auto; margin-right: auto } 联立方程模型(Simultaneous Equations Model, SEM)是一类包含多个相互依赖变量的统计模型,用来描述这些变量之间的相互关系。在传统的单一方程模型中,通常…

数据结构与算法 课程随记

数据结构与算法 课程随记因为有时候需要在不同设备编辑同一份文档,本地不太方便了,先在放着博客园比较省事吧。 但是博客园是不是快要四了啊,没事再整一个个人博客吧。 内容非常杂,因为不想去上课所以还是有点东西不会,就记录一下查不会东西的时候学会的东西。没什么参考价…