[英]Electron cannot find module because of wrong path
Im running a normal electron application, but when I run "npm start" it gives me the following error:我正在运行一个普通的电子应用程序,但是当我运行“npm start”时,它给了我以下错误:
Error: Cannot find module 'D:\\General\\projects\\electron\\cli.js'
错误:找不到模块 'D:\\General\\projects\\electron\\cli.js'
But the app folder is D:\\General\\projects\\testProject
and there it is the node_modules... and all the required folders in my test project.但是 app 文件夹是
D:\\General\\projects\\testProject
,它是 node_modules... 以及我的测试项目中所有必需的文件夹。
I've also tried installing globally and locally, updated npm and electron... but no results.我也试过在全球和本地安装,更新 npm 和电子......但没有结果。 As far as I can see, the error is that electron is not looking at the correct path but, how could I change the path where it looks for the cli?
据我所知,错误是电子没有看到正确的路径,但是,我怎么能改变它寻找 cli 的路径?
I found the problem, the directory had an special character at the name ( &
), so nodejs couldn't read the path correctly.我发现了问题,该目录的名称 (
&
) 处有一个特殊字符,因此 nodejs 无法正确读取路径。 I changed the name and now it works correctly.我更改了名称,现在它可以正常工作了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.