javascript - “术语 '/node.exe' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称”
问题描述
我正在尝试按照Twilio上的教程使用 Node.js 制作 CLI,并且在npm link
使用该命令后出现此错误。我读了一篇旧的溢出帖子,上面说要将节点添加到我的环境变量中,我有。
这是错误:
& : The term '/node.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\thedi\AppData\Roaming\npm\create-project.ps1:15 char:5
+ & "/node$exe" "$basedir/node_modules/@thedigs/create-project/bin/c ...
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (/node.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
这是我当前的代码:
// bin/create-project
#!/usr/bin/env/node
require = require('esm')(module /*, options */);
require('../src/cli').cli(process.argv);
// src/cli.js
export function cli(args) {
console.log(args);
}
// package.json
{
"name": "@thedigs/create-project",
"version": "1.0.0",
"description": "A CLI to bootstrap my new projects, whatever that means.",
"main": "src/index.js",
"scripts": {
"start": "nodemon ."
},
"publishConfig": {
"access": "public"
},
"bin": {
"@thedigs/create-project": "bin/create-project",
"create-project": "bin/create-project"
},
"keywords": [
"cli",
"create-project"
],
"author": "thedigs",
"license": "ISC",
"dependencies": {
"@types/node": "^14.14.31",
"esm": "^3.2.25",
"nodemon": "^2.0.7"
}
}
我最好的猜测是教程落后于版本,希望你们中的一个可以为我解决这个问题。谢谢!
解决方案
推荐阅读
- postgresql - Postgresql 逻辑复制,订阅者重复键错误
- ios - 不支持给定路径的格式 (Xamarin.Forms / iOS)
- excel - 无需选择 vba 即可复制和粘贴
- javascript - 如何将一个脚本用于多个按钮/链接?
- javascript - 是否可以访问 `functions.https.onCall` Firebase API 中的 `request` 和 `response` 对象?
- angular - 如何在角度打字稿12中下载pdf选项
- bash - 在while循环的每次迭代中回显变量
- javascript - 将远程 api json 数据显示到谷歌地图中
- vector - highchart 地图通过单击创建标记并获取经纬度坐标
- azureservicebus - 最新 SDK 即 Azure.Messaging.ServiceBus 中 Microsoft.Azure.ServiceBus 的 ITopicClient 的等价物是什么