0

当我运行 npm run comile:js 时,我遇到了这个问题。那么该怎么办?

PS C:\Users\Marko\Desktop\storefrontdata-master\storefrontdata-master> npm run compile:js
npm ERR! missing script: compile:js

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Marko\AppData\Roaming\npm-cache\_logs\2021-01-04T11_00_45_777Z-debug.log
PS C:\Users\Marko\Desktop\storefrontdata-master\storefrontdata-master> 

如果可以的话,这就是我的 package.json 的外观:

{
  "name": "refarchdata",
  "version": "4.4.1",
  "description": "This is a repository for the data that goes with the ref arch storefront.",
  "main": "",
  "dependencies": {},
  "devDependencies": {},
  "scripts": {
    "zipData": "if [ -f demo_data_sfra.zip ] ; then rm -r demo_data_sfra.zip && zip -r demo_data_sfra.zip demo_data_sfra ; else zip -r demo_data_sfra.zip demo_data_sfra ; fi"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/SalesforceCommerceCloud/storefrontdata.git"
  },
  "author": "",
  "license": "ISC",
  "homepage": "https://github.com/SalesforceCommerceCloud/storefrontdata"
}
4

2 回答 2

0

您应该在文件 package.json 中添加一个脚本,以便能够运行这种形状 npm run compile 它将检查 package.json 中是否有脚本,然后它将像这样运行

{
  //some code
 scripts : {
     "compile:js": "waht you need to put here",
 }
 

 }

如果你想运行文件,他的名字 compile.js 使用了带有文件位置的节点 node compile.js

于 2021-01-04T11:15:32.167 回答
0

错误已经告诉你原因:

no such file or directory, open 'C:\Users\Marko\Desktop\storefrontdata-master\package.json'

您的项目没有package.json文件。请确保你有一个。

更新后更新:打开 package.json(如果有),然后查找scripts并确保 compile:js 在它下面。该文件应如下所示:

// package.json
 {
  .....
 scripts : {
     "compile:js": "....",
 }
  ....

 }

于 2021-01-04T11:04:31.437 回答