[英]Node.js - Python-shell
我在安装python-shell时遇到了一些问题。
警告! 我是Javascript的新手,但是我吃,喝和睡Python。 我想将Python包含在我正在开发的任何程序中(如果可行)。
我正在创建一些桌面应用程序,希望通过一点HTML,CSS和Javascript香料使它们看起来很现代。
检查我的节点版本:
C:\nodejs\py-js\test>npm -v6.4.1
通过npm安装Python-Shell:
C:\nodejs\py-js\test>npm install python-shell
npm WARN saveError ENOENT: no such file or directory, open 'C:\nodejs\py-js\test\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\nodejs\py-js\test\package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README datanpm WARN test No license field.
python-shell@1.0.6 added 1 package from 1 contributor and audited 1 package in 1.827s found 0 vulnerabilities
npm测试
C:\nodejs\py-js\test2>npm test
npm ERR! path C:\nodejs\py-js\test2\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\nodejs\py-js\test2\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kurup\AppData\Roaming\npm-cache\_logs\2018-12-19T20_15_56_010Z-debug.log
救命! :(
您尚未初始化程序包。 运行此命令以创建package.json
文件:
npm init
然后,您可以定义您的测试脚本。
发生问题是因为您尝试使用npm test
命令行运行程序。
这是npm命令,用于运行特定的脚本,在这种情况下,您应该在package.json文件中提供“测试”脚本。 由于根本不创建package.json ,因此此命令失败。
例如,如果您使用npm init
生成package.json文件,则将获得以下默认“测试”脚本:
{
...
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
要启动程序,可以使用:
node test.js
或者,您可以在package.json中添加“开始”脚本并使用:
npm start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.