简体   繁体   English

为什么我会收到此 npm 错误:无法从“/home/directory”中找到模块“/home/directory”

[英]Why do i get this npm Error: Cannot find module '/home/directory' from '/home/directory'

I have the following scripts in my package.json file我的 package.json 文件中有以下脚本

 "scripts": {
    "start": "watchify -o js/bundle.js -v -d ."
  }

When i run npm start inside /home/directory i get this error Error: Cannot find module '/home/directory' from '/home/directory'当我在/home/directory运行npm start此错误Error: Cannot find module '/home/directory' from '/home/directory'

My directory structure is like我的目录结构就像

-/home/directory
          --package.json
          -js/
             --script1.js
             --script2.js   

Why am i getting this error?为什么我收到这个错误?

My guess is that you can pass multiple argument to watchify.我的猜测是您可以将多个参数传递给 watchify。 Lets say you remove the flags, you should get something like "watchify js/bundle.js ."假设您删除了标志,您应该得到类似"watchify js/bundle.js ." so watchify might be trying to run for both js/bundle.js and .所以 watchify 可能试图同时运行js/bundle.js. (the last one pointing to your current dir which is home/directory ) (最后一个指向您当前的目录,即home/directory

暂无
暂无

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

相关问题 ionic:Runtime Error找不到模块“ ../pages/home/home” - ionic:Runtime Error Cannot find module “../pages/home/home” 从服务器获取本地系统主目录路径 - Get local system home directory path from server 如何从grunt模板正确访问用户的主目录? - How do I correctly access the user's home directory from a grunt template? 为什么Webpack在我的主目录中寻找预设? - Why is Webpack looking for a preset in my home directory? npm启动错误“找不到模块:错误:无法解析目录” - npm start error “Module not found: Error: Cannot resolve directory” Next.js:模块构建失败:错误:无法从“/home/ugurkaya/Desktop”中找到模块“react-hot-loader/babel” - Next.js: Module build failed: Error: Cannot find module 'react-hot-loader/babel' from '/home/ugurkaya/Desktop' 错误:找不到模块“配置”:Javascript,模块位于同一文件夹目录中 - Error: Cannot find module 'config': Javascript, module is in the same folder directory 错误:无法从“/home/dolphin/sync/source/cruise-web”找到模块“@babel/plugin-proposal-decorators” - Error: Cannot find module '@babel/plugin-proposal-decorators' from '/home/dolphin/sync/source/cruise-web' 错误:在 ReactJS 项目中运行 npm 后找不到模块“serialize-javascript”,即使它存在于目录 node_modules - Error: Cannot find module 'serialize-javascript' after running npm start in ReactJS project, even though there it exists in directory node_modules 为什么我会收到错误:下载node.js后找不到模块? - Why do I get an error: Cannot find module after downloading node.js?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM