小编Cod*_*ing的帖子

Npm 脚本失败 - '.' 不被识别为内部或外部命令

这是错误日志

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cloudenly-hr-microservice@1.0.0 prestart: `sequelize db:migrate  && ./node_modules/.bin/sequelize db:seed:all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cloudenly-hr-microservice@1.0.0 prestart script.
Run Code Online (Sandbox Code Playgroud)

这是脚本

    "lint": "eslint",
    "test": "export NODE_ENV=test && mocha --timeout 100000",
    "prestart": "./node_modules/.bin/sequelize db:migrate  && ./node_modules/.bin/sequelize db:seed:all",
    "start": "./node_modules/pm2/bin/pm2 start pm2server.config.js",
    "poststart": "./node_modules/pm2/bin/pm2 log HumanR" 
Run Code Online (Sandbox Code Playgroud)

node.js npm

3
推荐指数
1
解决办法
3026
查看次数

如何秘密修改 Javascript 中的函数

我正在尝试修改一个函数:

console.error = function() {
  return "fake";
}
Run Code Online (Sandbox Code Playgroud)

但是,只需运行即可检测到该函数已更改toString()

> console.error.toString()
'function() {\nreturn "fake";\n}'
Run Code Online (Sandbox Code Playgroud)

如果函数没有被修改,'function () { [native code] }'则会返回。

解决方案可以是重写 toString(),但是,通过运行 toString 可以看到 toString 已被重写:

> console.error.toString = () => 'function () { [native code] }';
> console.error.toString()
'function () { [native code] }'
> console.error.toString.toString()
"() => 'function () { [ native code ] }'"
Run Code Online (Sandbox Code Playgroud)

无论如何,是否可以递归重写 toString() 或任何其他方法,以便无法检测到函数被重写?

用例是 WebExtension 修改某些功能,同时使网站尽可能难以检测到它。

javascript

3
推荐指数
1
解决办法
147
查看次数

本地 Kubernetes 中 Ingress 对象的类名称显示 <none>

我正在尝试在本地 kubernetes (Docker-Desktop) 中部署一个简单的 nginx 入口对象,但我注意到当我这样做时,类名显示为“none”:

\n
\xe2\x9e\x9c  localk8 k get ingress\nNAME               CLASS    HOSTS   ADDRESS     PORTS   AGE\ningress-resource   none   *       localhost   80      15m\n
Run Code Online (Sandbox Code Playgroud)\n

我的入口定义文件定义为:

\n
apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ingress-resource\n  annotations:\n    kubernetes.io/ingress.class: nginx\n    nginx.ingress.kubernetes.io/ssl-redirect: "false"\nspec:\n  rules:\n  - http:\n      paths:\n      - path: /hello\n        pathType: Prefix\n        backend:\n          service:\n            name: hello-app\n            port:\n              number: 8080\n
Run Code Online (Sandbox Code Playgroud)\n

如果这有什么区别的话,我也在 M1 MacBook 上运行。感谢大家的帮助!

\n

kubernetes

1
推荐指数
1
解决办法
3539
查看次数

我正在尝试创建反应应用程序,但一直告诉我未经授权的访问

PS C:\Users\Bonnie_Py\Desktop\fullstack js>  create-react-app
react-app create-react-app : File C:\Users\Bonnie_Py Dev\AppData\Roaming\npm\create-react-app.ps1 
cannot be loaded because running scripts is disabled on this system.  For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.

At line:1 char:2
 +  create-react-app react-app
 +  ~~~~~~~~~~~~~~~~
     + CategoryInfo          : SecurityError: (:) [], PSSecurityException
     + FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)

javascript node.js express

0
推荐指数
1
解决办法
3504
查看次数

标签 统计

javascript ×2

node.js ×2

express ×1

kubernetes ×1

npm ×1