简体   繁体   English

错误找不到模块路径json npm

[英]Error Cannot find module paths json npm

I'm trying to install google Transport Tracker from thin like https://developers.google.com/maps/solutions/transport-tracker/start 我正在尝试从瘦如https://developers.google.com/maps/solutions/transport-tracker/start安装google Transport Tracker

I did all the steps from cmd win 10 but I stuck in step npm install , and seems wind issue. 我完成了cmd win 10中的所有步骤,但是我陷入了npm install步骤,似乎出现了问题。

I am trying now google cloud shell and also stuck in npm run main step and got this error: 我现在正在尝试使用google cloud shell,并且也卡在npm run主要步骤中,并收到此错误:

 ghzoan@jernas-193723:~/backend$ npm run main > transport-tracker-server@1.0.0 main /home/ghzoan/backend > node main.js module.js:529 throw err; Error: Cannot find module './paths.json' at Function.Module._resolveFilename (module.js:527:15) at Function.Module._load (module.js:476:23) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object.<anonymous> (/home/ghzoan/backend/main.js:53:26) at Module._compile (module.js:624:30) at Object.Module._extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500:3) at Function.Module.runMain (module.js:665:10) at startup (bootstrap_node.js:201:16) at bootstrap_node.js:626:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! transport-tracker-server@1.0.0 main: `node main.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the transport-tracker-server@1.0.0 main script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in 

I got same the error with backend and map folders. 我也有后端和地图文件夹的错误。

You can see how the site look till now gps.jernascenter.com . 到现在为止,您都可以看到该网站的外观gps.jernascenter.com

It's been more than a week which I'm trying to install this script. 我已经尝试安装此脚本已经超过一个星期了。

The only reason you are getting this error is because node cannot find your .json file. 您收到此错误的唯一原因是因为节点找不到您的.json文件。

Be absolutely certain that you are telling node exactly where paths.json is located in your require statement. 绝对确定要告诉节点path.json在您的require语句中的确切位置。

This isn't necessarily easy, but using a good editor or IDE works for me. 这不一定很容易,但是使用一个好的编辑器或IDE对我有效。 It gives me 它给我

  1. A good visual overview of my project directory and subdirectories 我的项目目录和子目录的良好视觉概览
  2. Alerts me when the file path argument to a require statement cannot be resolved (before running the code) 当require语句的文件路径参数无法解析时(在运行代码之前)提醒我
  3. Generates the relative file path for me and places it in the clipboard so I can just paste into the require statement 为我生成相对文件路径并将其放置在剪贴板中,这样我就可以粘贴到require语句中

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

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