gpt4 book ai didi

node.js - npm 运行脚本不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 22:43:21 28 4
gpt4 key购买 nike

我刚刚使用 Node.js 初始化了一个新项目,并尝试使 package.json 文件中的脚本正常工作。

例如,我有下一个 package.json 文件:

{
"name": "my-app-name",
"version": "1.0.0",
"description": "Description server",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "Something LTD",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"cron": "^1.3.0",
"crypto": "^1.0.1",
"docusaurus-init": "^1.0.2",
"exceljs": "^1.5.0",
"express": "^4.16.3",
"express-limiter": "^1.6.1",
"jsonwebtoken": "^8.3.0",
"mongojs": "^2.6.0",
"npm": "^6.1.0",
"point-in-polygon": "^1.0.1",
"request": "^2.87.0",
"socket.io": "^2.1.1",
"socket.io-redis": "^5.2.0",
"xmldom": "^0.1.27"
},
"devDependencies": {
"t4u": "^1.0.0"
}
}

然后我尝试运行 npm testnpm startnpm run start但他们都什么都不做,并且在控制台中没有返回任何内容。即使测试脚本也不打印任何内容。

我尝试过:

npm config set --ignore-scripts false

然而这并没有奏效。

最佳答案

npm config set ignore-scripts false

问题已解决。

关于node.js - npm 运行脚本不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51314162/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com