首页 > 解决方案 > 如何使用 reactjs 的 package.json 脚本使文件可运行?

问题描述

我有一个文件夹 bin,其中包含文件 initLocale:

https://gist.github.com/IchrakMansour/6664b6e6dd871616dc3eae024f5e209f#file-initlocale

我想让它可运行并在文件 package.json 上制作:

"scripts": {
        "start": "npm run initLocale && react-scripts start",
        "build": "npm run initLocale:build && react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "initLocale": "bin/initLocale start && npm run compile",
        "initLocale:build": "bin/initLocale build && npm run compile",
        "add-locale": "lingui add-locale",
        "extract": "lingui extract",
        "compile": "lingui compile"
      },

当我跑步时npm run start,我得到:

> bin/initLocale start && npm run compil

'bin' n’est pas reconnu en tant que comm
ou externe, un programme exécutable ou u
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! alaxbayer@0.1.0 initLocale: `bi
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alaxbayer@0.1.0 i
npm ERR! This is probably not a problem 

npm ERR! A complete log of this run can 
npm ERR!     C:\Users\ichra\AppData\Roam
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! alaxbayer@0.1.0 start: `npm run
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alaxbayer@0.1.0 s
npm ERR! This is probably not a problem 

npm ERR! A complete log of this run can 
npm ERR!     C:\Users\ichra\AppData\Roam
The terminal process terminated with exi

我该如何解决?

标签: javascriptreactjspackage.jsonnpm-scriptsreact-scripts

解决方案


推荐阅读