我正在尝试通过卸载所有模块和节点本身来对我的计算机进行彻底的更换。另外,想还原所有我喜欢的配置,例如设置路径变量。请建议最好的方法,因为在卸载节点时出现以下错误:
Command: brew uninstall node
Error: No such keg: /usr/local/Cellar/node
Command: node -v
v4.2.2
Run Code Online (Sandbox Code Playgroud)
我怎样做一个干净的交换,然后重新开始。提前致谢。
我正在尝试使用nvm将本地节点版本从8.9.0更新到8.10.0。但这并没有得到体现。这是我尝试过的:
node -v
-> v8.9.0
nvm use 8.10.0
-> Now using node v8.10.0 (npm v5.5.1)
node -v
-> v8.9.0
我不知道为什么它不会改变。请让我知道我做错了什么。
我刚刚使用以下命令安装了 Node 和 Yarn:
brew install node
brew install yarn --without-node
node -v
v11.8.0
-a node
node is /usr/local/bin/node
yarn -v
1.13.0
type -a yarn
yarn is /usr/local/bin/yarn
Run Code Online (Sandbox Code Playgroud)
但是,如果我在终端中写的npm是“zsh:找不到命令:npm”
在我的:~/.zshrc我有:
ZSH=$HOME/.oh-my-zsh
# You can change the theme with another one:
# https://github.com/robbyrussell/oh-my-zsh/wiki/themes
ZSH_THEME="robbyrussell"
# Useful plugins for Rails development with Sublime Text
plugins=(gitfast last-working-dir common-aliases sublime zsh-syntax-highlighting history-substring-search)
# Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md
export HOMEBREW_NO_ANALYTICS=1
# Actually load Oh-My-Zsh
source "${ZSH}/oh-my-zsh.sh"
unalias rm # …Run Code Online (Sandbox Code Playgroud) 我只是想了解下面发生的事情。我正在使用 MacO,最近从 bash 切换到 zsh。然后我安装了 jupyterlab-lsp。你能赐教一下吗?
[W 14:27:11.102 LabApp] Failed to fetch commands from language server spec finder`bash-language-server`:
expected str, bytes or os.PathLike object, not tuple
[W 14:27:11.108 LabApp] Failed to fetch commands from language server spec finder`dockerfile-language-server-nodejs`:
expected str, bytes or os.PathLike object, not tuple
[W 14:27:11.113 LabApp] Failed to fetch commands from language server spec finder`javascript-typescript-langserver`:
expected str, bytes or os.PathLike object, not tuple
[W 14:27:11.125 LabApp] Failed to fetch commands from language server spec finder`unified-language-server`:
expected str, …Run Code Online (Sandbox Code Playgroud) 我正在 Mac 上重新整理文档,不小心损坏了我正在构建的应用程序。我注意到 package.json 已与 router.js 一起删除。我将这两个文件以及 package.json 中的 koa 依赖项添加回来进行测试。
控制台错误
Error: No valid exports main found for '/Users/devunderdog/Work space/Fantasy_Sports_Manager_Server/node_modules/koa'
at resolveExportsTarget (internal/modules/cjs/loader.js:611:9)
at applyExports (internal/modules/cjs/loader.js:492:14)
at resolveExports (internal/modules/cjs/loader.js:541:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:643:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:941:27)
at Function.Module._load (internal/modules/cjs/loader.js:847:27)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (internal/modules/cjs/helpers.js:69:18)
at Object.<anonymous> (/Users/devunderdog/Work space/Fantasy_Sports_Manager_Server/index.js:1:13)
at Module._compile (internal/modules/cjs/loader.js:1121:30) {
code: 'MODULE_NOT_FOUND'
}
Run Code Online (Sandbox Code Playgroud)
索引.JS
const Koa = require('koa');
const app = new Koa();
Run Code Online (Sandbox Code Playgroud)
这是 index.js 中的“koa” require 尝试获取模块的地方。 模块路径不正确
module "/Users/devunderdog/Library/Caches/typescript/3.9/node_modules/@types/koa/index"
Run Code Online (Sandbox Code Playgroud)
包.JSON
{
"name": "fantasy_sports_manager_server",
"version": "1.0.0", …Run Code Online (Sandbox Code Playgroud) 我node8个月前通过自制软件安装了。
我只是尝试通过自制软件升级节点,但没有成功。
相反,我得到一些鼓励我运行一行代码来对其进行修复的消息(我忘记了代码),但我认为它破坏了我的npm,因为我的npm停止工作了,现在我得到了错误:zsh: command not found: npm运行任何npm命令时。
我继续使用本指南完全卸载节点
然后,我开始使用本指南通过自制程序重新安装节点
当我去做冲泡医生时,我发现我坏了很多symlinks,包括很多npm文件,例如:
/usr/local/share/man/man1/npm-README.1
/usr/local/share/man/man1/npm-access.1
/usr/local/share/man/man1/npm-adduser.1
(以及大约60个其他npm文件和其他文件):
/ usr / local / bin / grunt
/ usr / local / bin / gulp
我从这里去哪里?我只是想重新安装node并npm通过自制软件,以便它们正常工作。我应该删除断开的符号链接,brew prune:还是会给我带来更多问题?谢谢。
我最近在我的 MacBook 上安装了NodeHigh Sierra 10.13 ,使用.pkg他们网站上提供的文件运行。
经过几个小时尝试安装其他软件包和编写脚本后,我决定卸载 Node和NPM 以重新开始。我尝试了该线程中的所有最佳答案,但令我沮丧的是,在遵循所有说明并多次重复所有步骤后,终端仍然可以识别 Node 和 NPM 版本。
我最终bash通过在同一个线程上找到的终端运行了一个脚本,该脚本最终什么也没做,只是将我当前的 Node 版本降级到0.10.8- 从长远来看,删除它变得更加困难。
我已经重新完成了上述线程中的所有步骤,但没有效果,终端仍然声明它有版本0.10.8(并且NPM完全无法工作)
目前我正处于该做什么的最后立场,所以希望这里有人可以帮助我解决我的问题。
干杯。
我正在尝试安装node-sass,但不允许我这样做。我尝试更新npm。
我把它放在:
须藤npm install -g node-sass
而我得到这个(从错误之前开始一行):
gyp verb build dir attempting to create "build" dir:
/Users/matt/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir
'/Users/matt/node_modules/node-sass/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node"
"/Users/matt/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "-
-verbose" "--libsass_ext=" "--libsass_cflags=" "--
libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/matt/node_modules/node-sass
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN enoent ENOENT: no such file or …Run Code Online (Sandbox Code Playgroud) 所以我是一个非常被宠坏的rubyist,基本上不再需要使用sudo安装任何东西了.我已经安装了node.js和npm(授予,使用Mac 64位.pkg,这可以让gosh知道我的系统上有什么)并且它们工作正常.
现在,执行以下操作:
npm install jasmine-node -g
不起作用并说:"请尝试以root/Administrator再次运行此命令." 我的意思是sudo npm install jasmine-node -g
这样做的:npm install jasmine-node(未全局)工作正常,但正确不设置我的道路,不通过命令行,运行等
如何应我安装茉莉花节点? cd对/usr/local/bin有安装(不"-g"选项)?使用自制软件?或者使用sudo ...我上面列出的命令?
谢谢.
/更新:如上所述,我使用通用安装程序在我的Lion OS X Mac(64位)上安装了node.js和npm,这是我在/ usr/local/bin中的节点/ npm列表,以防它们是帮助:
-rwxr-xr-x 1 24561 wheel 355 Apr 11 2012 /usr/local/bin/node-waf
-rwxr-xr-x 1 24561 wheel 18930304 Oct 25 14:07 /usr/local/bin/node
lrwxr-xr-x 1 root admin 38 Nov 12 10:00 /usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
Run Code Online (Sandbox Code Playgroud)
此外,我找到了这个答案,这是另一个选择(除了上面提到的三个).
请让我知道推荐哪种方法(再次,理想情况下,不使用'sudo'是我的偏好).
/ END UPDATE
以下是使用-g(全局)返回(不使用sudo)的方法:
npm …Run Code Online (Sandbox Code Playgroud) 我想用 npm 安装 webpack:
sudo npm install -g webpack
Run Code Online (Sandbox Code Playgroud)
这是我的错误:
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.7 and node@11.10.1 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/webpack/node_modules/fsevents/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/webpack/node_modules/fsevents/build'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/webpack/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/webpack/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=4" "--node_abi_napi=napi"
gyp ERR! cwd …Run Code Online (Sandbox Code Playgroud) 尽管我不知道它是什么,但我已经安装了node.js
我现在想从我的 Mac(Monterey OS 和 M1)上卸载它。但我在应用程序文件夹中找不到 Node.js,我在网上能找到的唯一信息是非常复杂的终端指令。再说一次,我不知道终端是什么,也不想使用它。
有卸载程序吗?或者简单的卸载方法?
我正在尝试使用 Puppeteer 框架运行脚本。(我是软件的相对新手)。每次我尝试运行时,都会出现以下错误。我确信代码没有问题,因为它之前在另一台机器上运行良好。这个错误在 main.js 进行(唯一的)函数调用时被记录下来。
SyntaxError: Invalid or unexpected token
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
Run Code Online (Sandbox Code Playgroud)
var puppeteer = require('puppeteer');
var $ = require('cheerio');
const url = 'https://www.reddit.com/controversial/';
?
puppeteer
.launch()
.then(function(browser) {
return browser.newPage();
})
.then(function(page) {
return page.goto(url).then(function() {
return page.content();
});
})
.then(function(html) {
$('h2', html).each(function() {
console.log($(this).text());
console.log('\r\n');
});
})
.catch(function(err) …Run Code Online (Sandbox Code Playgroud) node.js ×10
npm ×6
javascript ×2
backend ×1
cheerio ×1
homebrew ×1
jasmine ×1
jasmine-node ×1
jupyter ×1
jupyter-lab ×1
koa ×1
macos ×1
node-modules ×1
node-sass ×1
nvm ×1
puppeteer ×1
root ×1
sass ×1
symlink ×1
webpack ×1