首页 > 解决方案 > 我无法运行 npm run script 它显示了许多错误

问题描述

我尝试了很多次运行 npm 脚本 我还在package.json文件中添加了脚本,但它显示了一些错误实际上我正在构建一个网站,我需要 npm sass 来制作它,但是compile:sass我的脚本的 npm run 显示错误这是图像正面临问题。

这是脚本代码:

{  
   "name":"natours",
   "version":"1.0.0",
   "description":"landing page for natours",
   "main":"index.js",
   "scripts":{  
      "compile:sass":"node-sass sass/main.scss css/style.css"        <=====
   },
   "author":"Kishan",
   "license":"ISC",
   "devDependencies":{  
      "node-sass":"^4.9.0"
   }
}

这是命令提示符中的错误:

C:\Users\ANONYMOUS>npm run compile:sass
npm ERR! path C:\Users\ANONYMOUS\package.json 
npm ERR! code ENOENT 
npm ERR! errno -4058 
npm ERR! syscall open 
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\ANONYMOUS\package.json' 
npm ERR! enoent This is related to npm not being able to find a file. 
npm ERR! enoent 
npm ERR! A complete log of this run can be found in: 
npm ERR! C:\Users\ANONYMOUS\AppData\Roaming\npm-cache_logs\2018-06-17T05_39_21_109Z-debug.log C:\Users\ANONYMOUS>

标签: htmlcssnpmsasscommand-prompt

解决方案


您在 node-sass sass/main.scss 和 css/style.css 之间缺少逗号

它应该是 node-sass sass/main.scss, css/style.css


推荐阅读