简体   繁体   English

电子找不到模块 package.json

[英]electron cannot find module package.json

this is my first time using electron and im trying to run an express app, it gives me this error这是我第一次使用电子,我试图运行一个快速的应用程序,它给了我这个错误

Update code更新代码

Error: Cannot find module 'C:\package.json'
    at Module._resolveFilename (module.js:440:15)
    at Function.Module._resolveFilename (C:\Users\marku_000\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)

Any help is appreciated任何帮助表示赞赏

Have you moved your project from one dir to another?您是否将项目从一个目录移动到另一个目录? I got the same error when doing so and fixed it through the following steps:这样做时我遇到了同样的错误,并通过以下步骤修复了它:

1) Remove the node_modules dir; 1) 删除 node_modules 目录; rm -rf node_modules

2) Install the dependencies; 2) 安装依赖项; npm install

3) Build it again; 3)重新构建; npm run build:prod

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM