今天我尝试了解更多关于Google Web Starter Kit的信息,所以我按照这些说明操作,经过大量的斗争和问题后,我只是尝试启动本地服务器(我们将看到的第一个任务是:$ gulp serve
.)并收到此错误:
C:\ gwsk> gulp发球
Error: Cannot find module 'lodash'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\gwsk\node_modules\browser-sync\node_modules\portsc
anner-plus\lib\index.js:3:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\gwsk\node_modules\browser-sync\lib\utils.js:6:19)
Run Code Online (Sandbox Code Playgroud)
老实说,我完全迷失在这里,所以任何帮助都非常受欢迎.我是node.js的新手,为了吞咽,我只是想让它尝试GWSK但是变得头疼:( ...我是网页设计师而不是开发人员......
我想使用react.js和语义ui构建一个Web客户端.有一个节点包可以与react.js一起使用semantic-ui; 语义ui反应.我已按照react.semantic-ui.com/usage上的说明在我的计算机上安装了此软件包,但是在使用简单的网页进行测试时.
我想我有这个问题,因为我没有使用这最后一条指令:
import '.../semantic/dist/semantic.min.css';
.该semantic
文件夹已在我的项目主文件夹中生成,但该dist
文件夹semantic.min.css
尚未生成.我应该在哪里以及如何使用它?
注意:我也尝试将此添加<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link>
到我的index.html
页面,页面样式符合预期.我不想使用此选项,因为我无法使用它来更改它们.
在通常的 Windows 命令行中我看到:
C:\Users\me\myProject\UI> node --version
v8.12.0
C:\Users\me\myProject\UI> npm --version
6.11.3
C:\Users\me\myProject\UI> where node
C:\Program Files\nodejs\node.exe
C:\Users\me\myProject\UI> where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\me\AppData\Roaming\npm\npm
C:\Users\me\AppData\Roaming\npm\npm.cmd
Run Code Online (Sandbox Code Playgroud)
现在我正在使用 Visual Studio Professional 2017:如果我通过Tools > NuGet Packet Manager > Package Manager console打开 (Powershell) 终端,我会看到我喜欢的全局安装:
PM> pwd
Path
----
C:\myProject
PM> Get-Command npm
CommandType Name Version Source
----------- ---- ------- ------
Application npm.cmd 0.0.0.0 C:\Program Files\nodejs\npm.cmd
PM> node --version
v8.12.0
PM> npm --version
6.11.3
PM> Get-Command node
CommandType Name Version Source
----------- ---- ------- …
Run Code Online (Sandbox Code Playgroud) 团队,
我的 Ci Pipeline azure 失败在下面找到错误。我已经尝试了如何修复 ReferenceError 的解决方案:原始节点未在节点中定义,但没有运气
下面的错误:
##[section]Starting: gulp Package-Generate
==============================================================================
Task : Gulp
Description : Node.js streaming task based build system
Version : 0.141.2
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613721)
==============================================================================
[command]C:\npm\prefix\gulp.cmd Package-Generate --gulpfile d:\a\1\s\gulpfile.js --configuration release
fs.js:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at fs.js:27:26
at req_ (d:\a\1\s\node_modules\natives\index.js:143:24)
at Object.req [as require] (d:\a\1\s\node_modules\natives\index.js:55:10)
at Object.<anonymous> (d:\a\1\s\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at …
Run Code Online (Sandbox Code Playgroud) 所以我已经升级到 Visual Studio 16.6.3。当我转到 Task Runner Explorer 时,它不会加载我的 gulp 文件,在 Task Runner 输出窗口中,我可以看到...
Failed to run "E:\Projects\...\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
fs.js:35
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:35:5
at req_ (E:\Projects\...\node_modules\natives\index.js:143:24)
at Object.req [as require] (E:\Projects\...\node_modules\natives\index.js:55:10)
at Object.<anonymous> (E:\Projects\...\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
Run Code Online (Sandbox Code Playgroud)
然后我用谷歌搜索发现这是由于节点 12 和 gulp 3 之间不兼容,建议升级到版本 4。所以我更新了我的 package.json 文件并从“gulp”:“3.9.1”更改为“gulp”: “4.0.2”。当我转到任务资源管理器时,我在 Task Runner 输出窗口中看到以下内容...
Failed to run …
Run Code Online (Sandbox Code Playgroud) 我收到以下错误,我的节点版本是:12.18 when I run npm start to start my project
fs.js:36
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:36:5
Run Code Online (Sandbox Code Playgroud)
有人回答说它的 gulp 和节点 12 有问题(How to fix ReferenceError: primordials is not defined in node)
但我没有在我的项目中使用 gulp,也没有安装 gulp。
下面是我的 package.json
fs.js:36
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:36:5
Run Code Online (Sandbox Code Playgroud)
和我的 server.js:
{
"name":"myapp",
"version":"1.0.0",
"description":"",
"scripts":{
"start":"node server.js",
"test":"echo \"Error: no test specified\" && exit 1"
},
"author":"MJX",
"license":"ISC",
"dependencies":{
"body-parser":"^1.19.0",
"express":"^4.17.1",
"express-handlebars":"^2.0.1",
"mssql":"^6.2.1", …
Run Code Online (Sandbox Code Playgroud) 启动NativeScript Sidekick时,我从Windows出现了一个异常,指出以下内容(此错误消息也显示在Sidekick的输出Errors中):(UnhandledPromiseRejectionWarning: ReferenceError: primordials is not defined
为了更容易阅读,可以在底部找到错误的完整堆栈跟踪)
除了安装NativeScript Sidekick并打开应用程序外,我什么都没做。
我该如何解决这个问题?
(CLI) (node:6632) UnhandledPromiseRejectionWarning: ReferenceError: primordials is not defined
at fs.js:27:35
at req_ (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\natives\index.js:143:24)
at Object.req [as require] (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\natives\index.js:55:10)
at Object.<anonymous> (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\fstream\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (userFolder\AppData\Roaming\.nativescript-cli\extensions\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)
at emitWarning (internal/process/promises.js:120:15)
at processPromiseRejections (internal/process/promises.js:168:7)
at processTicksAndRejections (internal/process/task_queues.js:90:32)
(node:6632) ReferenceError: …
Run Code Online (Sandbox Code Playgroud) 我知道这个问题已经被问了很多次(例如 -在这里),但是解决方案要么不起作用,要么不适合我的场景。上面链接中提供的解决方案是:
解决方案:升级到 gulp 4 或降级到更早的节点。
所以,这就是我所拥有的:
• 节点:12.18.1 ( node -v
)
• Gulp:CLI 2.3.0,本地版本 4.0.2 ( gulp -v
)
我创建了全新的 React 应用程序:
npx create-react-app --template typescript react-app
Run Code Online (Sandbox Code Playgroud)
然后我转到应用程序文件夹(react-app)并在语义 UI站点上执行以下命令:
npm install semantic-ui --save
Run Code Online (Sandbox Code Playgroud)
当我尝试这样做gulp build
或gulp watch
出现以下错误时 -
ReferenceError: primordials is not defined
at fs.js:47:5
at req_ (/Users/testuser/projects/insights/node_modules/natives/index.js:143:24)
at Object.req [as require] (/Users/testuser/projects/insights/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/Users/testuser/projects/insights/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
Run Code Online (Sandbox Code Playgroud)
这些是以下模块和我安装的版本。
node -v
v16.2.0
npm -v
7.13.0
gulp -v
CLI version: 2.3.0
Local version: 3.9.1
Run Code Online (Sandbox Code Playgroud)
我使用的是 MacOS Catalina。有人可以帮我解决这个问题吗?
当我运行grunt serve
命令时,我遇到了新安装的 Angular 错误
我正在将 Node 12.6.1 与 Source Tree 一起使用并验证是否安装了 bower
Loading "cdnify.js" tasks...ERROR
>> ReferenceError: primordials is not defined
Running "serve" task
Running "clean:server" (clean) task
>> 1 path cleaned.
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "concurrent:server" (concurrent) task
Loading "cdnify.js" tasks...ERROR
>> ReferenceError: primordials is not defined
Running "copy:styles" (copy) task
Copied 3 files
Done.
Execution Time (2020-02-21 18:22:53 UTC+5:30)
loading tasks 13ms ??????????? 22%
copy:styles 45ms ????????????????????????????????????? 78%
Total 58ms
Running …
Run Code Online (Sandbox Code Playgroud) node.js ×8
gulp ×6
npm ×4
gulp-sass ×2
saas ×2
semantic-ui ×2
angular ×1
bower ×1
gruntjs ×1
gulp-watch ×1
nativescript ×1
reactjs ×1
sidekick ×1
windows ×1