【发布时间】:2019-06-05 21:02:05
【问题描述】:
我正在从事以前构建的项目。这个项目是使用 Node 和 Grunt 构建的。 我在项目的根文件夹中有一个 Gruntfile.js。
我在本地和全局都安装了 grunt,使用
npm i grunt
npm i -g grunt
之后,我在本地和全局安装了 grunt-cli,使用
npm i grunt-cli
npm i -g grunt-cli
当我尝试运行任何 grunt 命令(开发、初始化等)时,我得到了错误
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'findup-sync'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/lib/nodejs/grunt-cli/bin/grunt:8:14)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
我在很多论坛和这里也搜索过,但我没有找到答案。 有人可以帮帮我吗?
更新
在解决这个错误超过 24 小时后,我通过以下步骤修复了它:
- 通过 apt 在 Ubuntu 中安装 node-grunt-cli,就像 CPBL 在他的评论中所说的那样
apt install node-grunt-cli
在 OSX 上这不是必需的。
- 按照我在此blog 上找到的步骤进行操作。但是,我还需要运行命令
grunt develop
作为 sudo,即使更改了许多文件夹的权限。
【问题讨论】:
-
这里一样,即使安装了 findup-sync (
sudo apt install node-findup-sync这么说) -
看我的评论!我已修复此错误 \o/。也许这对你有用。尝试后发表评论。