简体   繁体   English

没有 npm 脚本适用于 react 项目

[英]No npm scripts works from react project

I have a React application, that has been working fine for a long time suddenly none of the npm commands in the package.JSON file works.我有一个 React 应用程序,它已经运行了很长时间,突然 package.JSON 文件中的 npm 命令都不起作用。

{


 "name": "fitness-appication-frontend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.10.2",
    "react-chat-ui": "^0.3.2",
    "react-dom": "^16.10.2",
    "react-scripts": "0.9.5"
  },
  "devDependencies": {},
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

whenever i try to run a npm command nothing happens in the terminal it just returns blank like such每当我尝试运行 npm 命令时,终端中什么都没有发生,它只是像这样返回空白

kristoffer@kristoffer-ThinkPad-T570:~/Skrivebord/Fitness-Application/fitness-application-frontend$ npm start
kristoffer@kristoffer-ThinkPad-T570:~/Skrivebord/Fitness-Application/fitness-application-frontend$

Is anybody familiar with this issue?有人熟悉这个问题吗?

It only happens when i try to run these commands, the built in ones, like npm install works fine enough.只有当我尝试运行这些命令时才会发生这种情况,内置命令,例如npm install工作得很好。

output of npm start run -dd npm start run -dd输出

npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start', '-dd' ]
npm info using npm@3.5.2
npm info using node@v8.10.0
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle fitness-appication-frontend@0.1.0~prestart: fitness-appication-frontend@0.1.0
npm info lifecycle fitness-appication-frontend@0.1.0~start: fitness-appication-frontend@0.1.0
npm info lifecycle fitness-appication-frontend@0.1.0~poststart: fitness-appication-frontend@0.1.0
npm verb exit

This happened because you have这是因为你有

ignore-scripts=true

From docs:从文档:

ignore-scripts忽略脚本

Default: false默认值:假

Type: Boolean类型:布尔型

If true, npm does not run scripts specified in package.json files.如果为 true,则 npm 不会运行 package.json 文件中指定的脚本。

Check this link检查此链接

PS You may use git log <branch name> to check when this change was done PS 您可以使用git log <branch name>来检查此更改何时完成

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

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